home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1994-04-21 | 263.3 KB | [ONLN/HLX2] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
100%
| file
| MacBinary II, inited, Wed Apr 20 09:14:09 1994, modified Thu Apr 21 08:06:53 1994, creator 'HLX2', type 'ONLN', 253272 bytes "Streams Component" , at 0x3ddd8 16108 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
100%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [ONLN] |
macFileCreator | [HLX2] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 11 53 74 72 65 61 6d | 73 20 43 6f 6d 70 6f 6e |..Stream|s Compon|
|00000010| 65 6e 74 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |ent.....|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 4f 4e 4c 4e 48 4c 58 | 32 01 00 00 00 00 00 00 |.ONLNHLX|2.......|
|00000050| 00 00 00 00 03 dd 58 00 | 00 3e ec a9 da db 21 a9 |......X.|.>....!.|
|00000060| dc 1c dd 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 42 38 00 00 |........|....B8..|
|00000080| 53 74 72 65 61 6d 73 20 | 43 6f 6d 70 6f 6e 65 6e |Streams |Componen|
|00000090| 74 20 0d 0d 49 6e 74 72 | 6f 64 75 63 74 69 6f 6e |t ..Intr|oduction|
|000000a0| 0d 54 68 65 20 4f 50 46 | 20 53 74 72 65 61 6d 73 |.The OPF| Streams|
|000000b0| 20 63 6f 6d 70 6f 6e 65 | 6e 74 20 70 72 6f 76 69 | compone|nt provi|
|000000c0| 64 65 73 20 69 6e 70 75 | 74 2f 6f 75 74 70 75 74 |des inpu|t/output|
|000000d0| 20 73 65 72 76 69 63 65 | 73 2e 20 54 68 65 73 65 | service|s. These|
|000000e0| 20 66 61 63 69 6c 69 74 | 69 65 73 20 61 72 65 20 | facilit|ies are |
|000000f0| 70 72 6f 76 69 64 65 64 | 20 62 79 20 74 68 65 20 |provided| by the |
|00000100| 4f 50 46 20 73 74 72 65 | 61 6d 73 2c 20 73 69 6e |OPF stre|ams, sin|
|00000110| 6b 73 2c 20 61 6e 64 20 | 73 74 72 65 61 6d 20 66 |ks, and |stream f|
|00000120| 6f 72 6d 61 74 74 65 72 | 73 20 63 6c 61 73 73 65 |ormatter|s classe|
|00000130| 73 2e 0d 4f 50 46 20 53 | 74 72 65 61 6d 73 20 63 |s..OPF S|treams c|
|00000140| 6f 6d 70 6f 6e 65 6e 74 | 20 70 72 6f 76 69 64 65 |omponent| provide|
|00000150| 73 20 73 65 72 76 69 63 | 65 73 20 77 68 69 63 68 |s servic|es which|
|00000160| 20 61 72 65 20 73 65 70 | 61 72 61 74 65 20 61 6e | are sep|arate an|
|00000170| 64 20 64 69 73 74 69 6e | 63 74 20 66 72 6f 6d 20 |d distin|ct from |
|00000180| 74 68 6f 73 65 20 70 72 | 6f 76 69 64 65 64 20 62 |those pr|ovided b|
|00000190| 79 20 61 6e 20 69 6d 70 | 6c 65 6d 65 6e 74 61 74 |y an imp|lementat|
|000001a0| 69 6f 6e 20 6f 66 20 74 | 68 65 20 49 4f 53 74 72 |ion of t|he IOStr|
|000001b0| 65 61 6d 73 20 63 6c 61 | 73 73 20 6c 69 62 72 61 |eams cla|ss libra|
|000001c0| 72 79 2e 20 54 68 65 20 | 4f 50 46 20 53 74 72 65 |ry. The |OPF Stre|
|000001d0| 61 6d 73 20 63 6f 6d 70 | 6f 6e 65 6e 74 20 69 73 |ams comp|onent is|
|000001e0| 20 63 6f 6d 70 61 74 69 | 62 6c 65 20 77 69 74 68 | compati|ble with|
|000001f0| 20 74 68 65 20 43 2b 2b | 20 49 4f 53 74 72 65 61 | the C++| IOStrea|
|00000200| 6d 73 20 6c 69 62 72 61 | 72 79 2e 20 59 6f 75 20 |ms libra|ry. You |
|00000210| 6d 61 79 20 63 6f 6e 74 | 69 6e 75 65 20 74 6f 20 |may cont|inue to |
|00000220| 75 73 65 20 79 6f 75 72 | 20 63 75 72 72 65 6e 74 |use your| current|
|00000230| 20 49 4f 53 74 72 65 61 | 6d 73 20 6c 69 62 72 61 | IOStrea|ms libra|
|00000240| 72 79 20 77 68 65 6e 20 | 63 6f 6e 76 65 6e 69 65 |ry when |convenie|
|00000250| 6e 74 2e 0d 53 74 72 65 | 61 6d 73 20 4f 76 65 72 |nt..Stre|ams Over|
|00000260| 76 69 65 77 0d 54 68 65 | 20 4f 50 46 20 53 74 72 |view.The| OPF Str|
|00000270| 65 61 6d 73 20 63 6f 6d | 70 6f 6e 65 6e 74 20 69 |eams com|ponent i|
|00000280| 6e 63 6c 75 64 65 73 20 | 73 69 78 20 63 6c 61 73 |ncludes |six clas|
|00000290| 73 65 73 20 61 6e 64 20 | 31 37 33 20 6d 65 74 68 |ses and |173 meth|
|000002a0| 6f 64 73 2e 20 54 68 72 | 65 65 20 73 69 6e 6b 73 |ods. Thr|ee sinks|
|000002b0| 20 63 6c 61 73 73 65 73 | 20 6c 6f 63 61 74 65 64 | classes| located|
|000002c0| 20 69 6e 20 6f 74 68 65 | 72 20 63 6f 6d 70 6f 6e | in othe|r compon|
|000002d0| 65 6e 74 73 20 64 65 73 | 63 65 6e 64 20 66 72 6f |ents des|cend fro|
|000002e0| 6d 20 61 62 73 74 72 61 | 63 74 20 62 61 73 65 20 |m abstra|ct base |
|000002f0| 63 6c 61 73 73 65 73 20 | 69 6e 20 74 68 69 73 20 |classes |in this |
|00000300| 63 6f 6d 70 6f 6e 65 6e | 74 2e 20 0d 54 68 69 73 |componen|t. .This|
|00000310| 20 73 65 63 74 69 6f 6e | 20 6c 69 73 74 73 20 61 | section| lists a|
|00000320| 6e 64 20 64 65 66 69 6e | 65 73 20 6d 61 6a 6f 72 |nd defin|es major|
|00000330| 20 63 6c 61 73 73 65 73 | 2c 20 72 65 76 69 65 77 | classes|, review|
|00000340| 73 20 6d 61 6a 6f 72 20 | 63 6f 6e 63 65 70 74 73 |s major |concepts|
|00000350| 2c 20 64 65 73 69 67 6e | 20 63 6f 6e 73 69 64 65 |, design| conside|
|00000360| 72 61 74 69 6f 6e 73 2c | 20 63 6f 6d 70 6f 6e 65 |rations,| compone|
|00000370| 6e 74 20 73 74 72 75 63 | 74 75 72 65 2c 20 63 6c |nt struc|ture, cl|
|00000380| 61 73 73 20 69 6e 74 65 | 72 66 61 63 65 73 20 61 |ass inte|rfaces a|
|00000390| 6e 64 20 64 65 70 65 6e | 64 65 6e 63 69 65 73 2e |nd depen|dencies.|
|000003a0| 0d 44 69 72 65 63 74 6f | 72 79 0d 46 57 53 74 72 |.Directo|ry.FWStr|
|000003b0| 65 61 6d 0d 48 65 72 69 | 74 61 67 65 0d 46 57 5f |eam.Heri|tage.FW_|
|000003c0| 43 52 65 61 64 61 62 6c | 65 53 74 72 65 61 6d 09 |CReadabl|eStream.|
|000003d0| 32 35 09 0d 46 57 5f 43 | 52 65 61 64 61 62 6c 65 |25..FW_C|Readable|
|000003e0| 53 74 72 65 61 6d 46 6f | 72 6d 61 74 74 65 72 09 |StreamFo|rmatter.|
|000003f0| 33 33 09 0d 46 57 5f 43 | 53 69 6e 6b 09 33 39 09 |33..FW_C|Sink.39.|
|00000400| 0d a5 46 57 5f 43 52 61 | 6e 64 6f 6d 41 63 63 65 |..FW_CRa|ndomAcce|
|00000410| 73 73 53 69 6e 6b 09 32 | 31 09 0d a5 a5 46 57 5f |ssSink.2|1....FW_|
|00000420| 43 46 69 6c 65 41 63 63 | 65 73 73 09 78 78 09 0d |CFileAcc|ess.xx..|
|00000430| a5 a5 46 57 5f 43 4d 65 | 6d 6f 72 79 53 69 6e 6b |..FW_CMe|morySink|
|00000440| 09 31 35 09 0d a5 a5 a5 | 46 57 5f 43 52 65 73 6f |.15.....|FW_CReso|
|00000450| 75 72 63 65 53 69 6e 6b | 09 78 78 09 0d 46 57 5f |urceSink|.xx..FW_|
|00000460| 43 57 72 69 74 61 62 6c | 65 53 74 72 65 61 6d 09 |CWritabl|eStream.|
|00000470| 35 31 09 0d 46 57 5f 43 | 57 72 69 74 61 62 6c 65 |51..FW_C|Writable|
|00000480| 53 74 72 65 61 6d 46 6f | 72 6d 61 74 74 65 72 09 |StreamFo|rmatter.|
|00000490| 35 37 09 0d 46 57 5f 58 | 50 72 69 76 45 78 63 65 |57..FW_X|PrivExce|
|000004a0| 70 74 69 6f 6e 09 78 78 | 0d 53 74 72 65 61 6d 73 |ption.xx|.Streams|
|000004b0| 20 63 6f 6d 70 6f 6e 65 | 6e 74 20 62 61 73 65 20 | compone|nt base |
|000004c0| 63 6c 61 73 73 65 73 0d | 54 68 65 20 53 74 72 65 |classes.|The Stre|
|000004d0| 61 6d 73 20 63 6f 6d 70 | 6f 6e 65 6e 74 20 69 73 |ams comp|onent is|
|000004e0| 20 6c 6f 63 61 74 65 64 | 20 69 6e 20 74 68 65 20 | located| in the |
|000004f0| 66 6f 75 6e 64 61 74 69 | 6f 6e 20 6c 61 79 65 72 |foundati|on layer|
|00000500| 2e 20 43 6c 61 73 73 65 | 73 20 61 72 65 20 6c 65 |. Classe|s are le|
|00000510| 66 74 20 6c 6f 6f 73 65 | 6c 79 20 62 6f 75 6e 64 |ft loose|ly bound|
|00000520| 20 74 6f 20 61 6c 6c 6f | 77 20 6f 74 68 65 72 20 | to allo|w other |
|00000530| 63 6f 6d 70 6f 6e 65 6e | 74 73 20 65 61 73 79 20 |componen|ts easy |
|00000540| 61 63 63 65 73 73 20 74 | 6f 20 74 68 65 6d 2e 20 |access t|o them. |
|00000550| 0d 53 74 72 65 61 6d 20 | 63 6f 6d 70 6f 6e 65 6e |.Stream |componen|
|00000560| 74 20 63 6c 61 73 73 65 | 73 20 61 72 65 20 64 65 |t classe|s are de|
|00000570| 73 63 72 69 62 65 64 20 | 62 65 6c 6f 77 3a 0d 46 |scribed |below:.F|
|00000580| 57 5f 43 52 65 61 64 61 | 62 6c 65 2d 53 74 72 65 |W_CReada|ble-Stre|
|00000590| 61 6d 09 41 20 72 65 61 | 64 61 62 6c 65 20 73 74 |am.A rea|dable st|
|000005a0| 72 65 61 6d 20 63 6f 6e | 6e 65 63 74 73 20 61 20 |ream con|nects a |
|000005b0| 73 69 6e 6b 20 74 6f 20 | 61 20 72 65 61 64 61 62 |sink to |a readab|
|000005c0| 6c 65 20 73 74 72 65 61 | 6d 20 66 6f 72 6d 61 74 |le strea|m format|
|000005d0| 74 65 72 2e 20 09 0d 46 | 57 5f 43 57 72 69 74 61 |ter. ..F|W_CWrita|
|000005e0| 62 6c 65 2d 53 74 72 65 | 61 6d 09 41 20 77 72 69 |ble-Stre|am.A wri|
|000005f0| 74 61 62 6c 65 20 73 74 | 72 65 61 6d 20 63 6f 6e |table st|ream con|
|00000600| 6e 65 63 74 73 20 61 20 | 73 69 6e 6b 20 74 6f 20 |nects a |sink to |
|00000610| 61 20 77 72 69 74 61 62 | 6c 65 20 73 74 72 65 61 |a writab|le strea|
|00000620| 6d 20 66 6f 72 6d 61 74 | 74 65 72 2e 20 09 0d 46 |m format|ter. ..F|
|00000630| 57 5f 43 52 65 61 64 61 | 62 6c 65 2d 53 74 72 65 |W_CReada|ble-Stre|
|00000640| 61 6d 46 6f 72 6d 61 74 | 74 65 72 09 41 20 72 65 |amFormat|ter.A re|
|00000650| 61 64 61 62 6c 65 20 73 | 74 72 65 61 6d 20 68 61 |adable s|tream ha|
|00000660| 73 20 61 20 72 65 61 64 | 61 62 6c 65 20 73 74 72 |s a read|able str|
|00000670| 65 61 6d 20 66 6f 72 6d | 61 74 74 65 72 2e 20 54 |eam form|atter. T|
|00000680| 68 65 20 66 6f 72 6d 61 | 74 74 65 72 20 69 73 20 |he forma|tter is |
|00000690| 72 65 73 70 6f 6e 73 69 | 62 6c 65 20 66 6f 72 20 |responsi|ble for |
|000006a0| 66 6f 72 6d 61 74 74 69 | 6e 67 20 74 68 65 20 64 |formatti|ng the d|
|000006b0| 61 74 61 20 72 65 61 64 | 20 66 72 6f 6d 20 74 68 |ata read| from th|
|000006c0| 65 20 72 65 61 64 61 62 | 6c 65 20 73 74 72 65 61 |e readab|le strea|
|000006d0| 6d 27 73 20 73 69 6e 6b | 20 74 6f 20 6d 61 74 63 |m's sink| to matc|
|000006e0| 68 20 74 68 65 20 64 61 | 74 61 20 74 79 70 65 20 |h the da|ta type |
|000006f0| 72 65 71 75 65 73 74 65 | 64 20 62 79 20 74 68 65 |requeste|d by the|
|00000700| 20 72 65 61 64 61 62 6c | 65 20 73 74 72 65 61 6d | readabl|e stream|
|00000710| 2e 09 0d 46 57 5f 43 57 | 72 69 74 61 62 6c 65 2d |...FW_CW|ritable-|
|00000720| 53 74 72 65 61 6d 46 6f | 72 6d 61 74 74 65 72 09 |StreamFo|rmatter.|
|00000730| 41 20 77 72 69 74 61 62 | 6c 65 20 73 74 72 65 61 |A writab|le strea|
|00000740| 6d 20 68 61 73 20 61 20 | 77 72 69 74 61 62 6c 65 |m has a |writable|
|00000750| 20 73 74 72 65 61 6d 20 | 66 6f 72 6d 61 74 74 65 | stream |formatte|
|00000760| 72 2e 20 54 68 65 20 66 | 6f 72 6d 61 74 74 65 72 |r. The f|ormatter|
|00000770| 20 69 73 20 72 65 73 70 | 6f 6e 73 69 62 6c 65 20 | is resp|onsible |
|00000780| 66 6f 72 20 66 6f 72 6d | 61 74 74 69 6e 67 20 74 |for form|atting t|
|00000790| 68 65 20 64 61 74 61 20 | 77 72 69 74 74 65 6e 20 |he data |written |
|000007a0| 74 6f 20 74 68 65 20 77 | 72 69 74 61 62 6c 65 20 |to the w|ritable |
|000007b0| 73 74 72 65 61 6d 27 73 | 20 73 69 6e 6b 20 74 6f |stream's| sink to|
|000007c0| 20 6d 61 74 63 68 20 74 | 68 65 20 64 61 74 61 20 | match t|he data |
|000007d0| 74 79 70 65 20 72 65 71 | 75 65 73 74 65 64 20 62 |type req|uested b|
|000007e0| 79 20 74 68 65 20 77 72 | 69 74 61 62 6c 65 20 73 |y the wr|itable s|
|000007f0| 74 72 65 61 6d 2e 20 09 | 0d 46 57 5f 43 53 69 6e |tream. .|.FW_CSin|
|00000800| 6b 09 41 62 73 74 72 61 | 63 74 20 62 61 73 65 20 |k.Abstra|ct base |
|00000810| 63 6c 61 73 73 20 66 6f | 72 20 73 75 70 70 6f 72 |class fo|r suppor|
|00000820| 74 69 6e 67 20 49 2f 4f | 20 64 65 76 69 63 65 73 |ting I/O| devices|
|00000830| 2e 09 0d 46 57 5f 43 52 | 61 6e 64 6f 6d 41 63 63 |...FW_CR|andomAcc|
|00000840| 65 73 73 2d 0d 53 69 6e | 6b 09 41 62 73 74 72 61 |ess-.Sin|k.Abstra|
|00000850| 63 74 20 62 61 73 65 20 | 63 6c 61 73 73 20 77 68 |ct base |class wh|
|00000860| 69 63 68 20 73 75 70 70 | 6f 72 74 73 20 72 61 6e |ich supp|orts ran|
|00000870| 64 6f 6d 20 61 63 63 65 | 73 73 20 49 2f 4f 20 64 |dom acce|ss I/O d|
|00000880| 65 76 69 63 65 73 2e 09 | 0d 46 57 5f 43 46 69 6c |evices..|.FW_CFil|
|00000890| 65 41 63 63 65 73 73 09 | 43 6f 6e 63 72 65 74 65 |eAccess.|Concrete|
|000008a0| 20 73 75 62 63 6c 61 73 | 73 20 6f 66 20 46 57 5f | subclas|s of FW_|
|000008b0| 43 52 61 6e 64 6f 6d 41 | 63 63 65 73 73 53 69 6e |CRandomA|ccessSin|
|000008c0| 6b 20 77 68 69 63 68 20 | 72 65 70 72 65 73 65 6e |k which |represen|
|000008d0| 74 73 20 61 20 64 69 73 | 6b 20 66 69 6c 65 2e 20 |ts a dis|k file. |
|000008e0| 4d 65 6d 62 65 72 20 6f | 66 20 46 69 6c 65 73 20 |Member o|f Files |
|000008f0| 63 6f 6d 70 6f 6e 65 6e | 74 2e 09 0d 46 57 5f 43 |componen|t...FW_C|
|00000900| 4d 65 6d 6f 72 79 53 69 | 6e 6b 09 43 6f 6e 63 72 |MemorySi|nk.Concr|
|00000910| 65 74 65 20 73 75 62 63 | 6c 61 73 73 20 6f 66 20 |ete subc|lass of |
|00000920| 46 57 5f 43 52 61 6e 64 | 6f 6d 41 63 63 65 73 73 |FW_CRand|omAccess|
|00000930| 53 69 6e 6b 20 77 68 69 | 63 68 20 72 65 70 72 65 |Sink whi|ch repre|
|00000940| 73 65 6e 74 73 20 61 20 | 6d 65 6d 6f 72 79 20 62 |sents a |memory b|
|00000950| 75 66 66 65 72 2e 09 0d | 46 57 5f 43 52 65 73 6f |uffer...|FW_CReso|
|00000960| 75 72 63 65 53 69 6e 6b | 09 43 6f 6e 63 72 65 74 |urceSink|.Concret|
|00000970| 65 20 73 75 62 63 6c 61 | 73 73 20 6f 66 20 46 57 |e subcla|ss of FW|
|00000980| 5f 43 4d 65 6d 6f 72 79 | 53 69 6e 6b 20 77 68 69 |_CMemory|Sink whi|
|00000990| 63 68 20 72 65 70 72 65 | 73 65 6e 74 73 20 61 20 |ch repre|sents a |
|000009a0| 72 65 61 64 2d 6f 6e 6c | 79 20 69 6d 61 67 65 20 |read-onl|y image |
|000009b0| 6f 66 20 61 20 72 65 73 | 6f 75 72 63 65 20 69 6e |of a res|ource in|
|000009c0| 20 6d 65 6d 6f 72 79 2e | 20 4d 65 6d 62 65 72 20 | memory.| Member |
|000009d0| 6f 66 20 52 65 73 6f 75 | 72 63 65 73 20 63 6f 6d |of Resou|rces com|
|000009e0| 70 6f 6e 65 6e 74 2e 09 | 0d 20 0d 46 69 67 75 72 |ponent..|. .Figur|
|000009f0| 65 20 31 15 31 20 53 74 | 72 65 61 6d 73 20 63 6f |e 1.1 St|reams co|
|00000a00| 6d 70 6f 6e 65 6e 74 20 | 68 69 65 72 61 72 63 68 |mponent |hierarch|
|00000a10| 79 2e 0d 4f 74 68 65 72 | 20 63 6f 6d 70 6f 6e 65 |y..Other| compone|
|00000a20| 6e 74 20 73 74 72 75 63 | 74 75 72 65 73 0d 54 68 |nt struc|tures.Th|
|00000a30| 69 73 20 63 6f 6d 70 6f | 6e 65 6e 74 20 64 65 66 |is compo|nent def|
|00000a40| 69 6e 65 73 20 74 68 65 | 20 65 78 63 65 70 74 69 |ines the| excepti|
|00000a50| 6f 6e 20 63 6c 61 73 73 | 65 73 20 46 57 5f 58 52 |on class|es FW_XR|
|00000a60| 65 61 64 61 62 6c 65 2d | 53 74 72 65 61 6d 46 6f |eadable-|StreamFo|
|00000a70| 72 6d 61 74 74 65 72 20 | 61 6e 64 20 46 57 5f 58 |rmatter |and FW_X|
|00000a80| 57 72 69 74 61 62 6c 65 | 53 74 72 65 61 6d 46 6f |Writable|StreamFo|
|00000a90| 72 6d 61 74 74 65 72 2e | 0d 53 74 72 65 61 6d 73 |rmatter.|.Streams|
|00000aa0| 20 63 6f 6d 70 6f 6e 65 | 6e 74 20 63 6f 6e 63 65 | compone|nt conce|
|00000ab0| 70 74 73 0d 54 68 65 20 | 53 74 72 65 61 6d 73 20 |pts.The |Streams |
|00000ac0| 63 6f 6d 70 6f 6e 65 6e | 74 20 75 73 65 73 20 74 |componen|t uses t|
|00000ad0| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 70 72 6f |he follo|wing pro|
|00000ae0| 67 72 61 6d 6d 69 6e 67 | 20 61 62 73 74 72 61 63 |gramming| abstrac|
|00000af0| 74 69 6f 6e 73 3a 0d a5 | 09 41 20 73 69 6e 6b 20 |tions:..|.A sink |
|00000b00| 69 73 20 61 20 73 6f 66 | 74 77 61 72 65 20 69 6e |is a sof|tware in|
|00000b10| 74 65 72 66 61 63 65 20 | 74 6f 20 61 20 70 68 79 |terface |to a phy|
|00000b20| 73 69 63 61 6c 20 64 65 | 76 69 63 65 20 6f 72 20 |sical de|vice or |
|00000b30| 6f 74 68 65 72 20 65 6e | 74 69 74 79 20 74 68 61 |other en|tity tha|
|00000b40| 74 20 63 61 6e 20 61 63 | 63 65 70 74 20 6f 72 20 |t can ac|cept or |
|00000b50| 70 72 6f 76 69 64 65 20 | 64 61 74 61 20 74 6f 20 |provide |data to |
|00000b60| 61 20 70 72 6f 67 72 61 | 6d 2e 20 4f 50 46 20 73 |a progra|m. OPF s|
|00000b70| 69 6e 6b 73 20 63 61 6e | 20 62 65 20 6d 6f 64 69 |inks can| be modi|
|00000b80| 66 69 65 64 20 74 6f 20 | 73 75 70 70 6f 72 74 20 |fied to |support |
|00000b90| 61 20 76 61 72 69 65 74 | 79 20 6f 66 20 64 65 76 |a variet|y of dev|
|00000ba0| 69 63 65 73 2e 0d 0d 54 | 68 65 20 53 74 72 65 61 |ices...T|he Strea|
|00000bb0| 6d 73 20 63 6f 6d 70 6f | 6e 65 6e 74 20 70 72 6f |ms compo|nent pro|
|00000bc0| 76 69 64 65 73 20 74 77 | 6f 20 61 62 73 74 72 61 |vides tw|o abstra|
|00000bd0| 63 74 20 62 61 73 65 20 | 73 69 6e 6b 20 63 6c 61 |ct base |sink cla|
|00000be0| 73 73 65 73 2c 20 46 57 | 5f 43 53 69 6e 6b 20 66 |sses, FW|_CSink f|
|00000bf0| 6f 72 20 73 65 72 69 61 | 6c 20 64 65 76 69 63 65 |or seria|l device|
|00000c00| 73 20 61 6e 64 20 46 57 | 5f 43 52 61 6e 64 6f 6d |s and FW|_CRandom|
|00000c10| 2d 41 63 63 65 73 73 53 | 69 6e 6b 20 66 6f 72 20 |-AccessS|ink for |
|00000c20| 72 61 6e 64 6f 6d 20 61 | 63 63 65 73 73 20 64 65 |random a|ccess de|
|00000c30| 76 69 63 65 73 2e 20 46 | 6f 72 20 63 6f 6e 76 65 |vices. F|or conve|
|00000c40| 6e 69 65 6e 63 65 2c 20 | 4f 50 46 20 61 6c 73 6f |nience, |OPF also|
|00000c50| 20 70 72 6f 76 69 64 65 | 73 20 63 6f 6e 63 72 65 | provide|s concre|
|00000c60| 74 65 20 73 69 6e 6b 20 | 63 6c 61 73 73 65 73 20 |te sink |classes |
|00000c70| 73 75 70 70 6f 72 74 69 | 6e 67 20 6d 65 6d 6f 72 |supporti|ng memor|
|00000c80| 79 20 62 75 66 66 65 72 | 73 2c 20 64 69 73 6b 20 |y buffer|s, disk |
|00000c90| 66 69 6c 65 73 2c 20 61 | 6e 64 20 72 65 73 6f 75 |files, a|nd resou|
|00000ca0| 72 63 65 73 2e 0d a5 09 | 41 20 73 74 72 65 61 6d |rces....|A stream|
|00000cb0| 20 66 6f 72 6d 61 74 74 | 65 72 20 69 73 20 61 6e | formatt|er is an|
|00000cc0| 20 6f 62 6a 65 63 74 20 | 77 68 69 63 68 20 74 72 | object |which tr|
|00000cd0| 61 6e 73 6c 61 74 65 73 | 20 64 61 74 61 20 69 6e |anslates| data in|
|00000ce0| 73 65 72 74 65 64 20 6f | 72 20 65 78 74 72 61 63 |serted o|r extrac|
|00000cf0| 74 65 64 20 66 72 6f 6d | 20 61 20 73 74 72 65 61 |ted from| a strea|
|00000d00| 6d 2e 20 0d 0d 54 68 65 | 20 53 74 72 65 61 6d 73 |m. ..The| Streams|
|00000d10| 20 63 6f 6d 70 6f 6e 65 | 6e 74 20 69 6e 63 6c 75 | compone|nt inclu|
|00000d20| 64 65 73 20 72 65 61 64 | 61 62 6c 65 20 61 6e 64 |des read|able and|
|00000d30| 20 77 72 69 74 61 62 6c | 65 20 73 74 72 65 61 6d | writabl|e stream|
|00000d40| 20 66 6f 72 6d 61 74 74 | 65 72 20 63 6c 61 73 73 | formatt|er class|
|00000d50| 65 73 2e 20 53 74 72 65 | 61 6d 20 66 6f 72 6d 61 |es. Stre|am forma|
|00000d60| 74 74 65 72 73 20 61 72 | 65 20 64 65 73 69 67 6e |tters ar|e design|
|00000d70| 65 64 20 73 6f 20 79 6f | 75 20 63 61 6e 20 77 72 |ed so yo|u can wr|
|00000d80| 69 74 65 20 79 6f 75 72 | 20 6f 77 6e 20 63 75 73 |ite your| own cus|
|00000d90| 74 6f 6d 20 73 75 62 63 | 6c 61 73 73 65 73 2e 20 |tom subc|lasses. |
|00000da0| 0d 0d 4f 50 46 20 70 72 | 6f 76 69 64 65 73 20 69 |..OPF pr|ovides i|
|00000db0| 64 65 6e 74 69 74 79 20 | 73 74 72 65 61 6d 20 66 |dentity |stream f|
|00000dc0| 6f 72 6d 61 74 74 65 72 | 73 2c 20 46 57 5f 43 52 |ormatter|s, FW_CR|
|00000dd0| 65 61 64 2d 61 62 6c 65 | 53 74 72 65 61 6d 46 6f |ead-able|StreamFo|
|00000de0| 72 6d 61 74 74 65 72 20 | 61 6e 64 20 46 57 5f 43 |rmatter |and FW_C|
|00000df0| 57 72 69 74 61 62 6c 65 | 53 74 72 65 61 6d 2d 46 |Writable|Stream-F|
|00000e00| 6f 72 6d 61 74 74 65 72 | 2c 20 77 68 69 63 68 20 |ormatter|, which |
|00000e10| 70 61 73 73 20 64 61 74 | 61 20 77 69 74 68 6f 75 |pass dat|a withou|
|00000e20| 74 20 6d 6f 64 69 66 69 | 63 61 74 69 6f 6e 20 62 |t modifi|cation b|
|00000e30| 65 74 77 65 65 6e 20 74 | 68 65 20 73 69 6e 6b 20 |etween t|he sink |
|00000e40| 61 6e 64 20 74 68 65 20 | 73 74 72 65 61 6d 27 73 |and the |stream's|
|00000e50| 20 63 6c 69 65 6e 74 2e | 20 4f 50 46 20 61 6c 73 | client.| OPF als|
|00000e60| 6f 20 70 72 6f 76 69 64 | 65 73 20 46 57 5f 43 53 |o provid|es FW_CS|
|00000e70| 77 61 70 42 79 74 65 73 | 46 6f 72 6d 61 74 74 65 |wapBytes|Formatte|
|00000e80| 72 2c 20 61 20 72 65 61 | 64 61 62 6c 65 20 73 74 |r, a rea|dable st|
|00000e90| 72 65 61 6d 20 66 6f 72 | 6d 61 74 74 65 72 20 74 |ream for|matter t|
|00000ea0| 68 61 74 20 70 65 72 66 | 6f 72 6d 73 20 62 79 74 |hat perf|orms byt|
|00000eb0| 65 20 72 65 6f 72 64 65 | 72 69 6e 67 20 66 6f 72 |e reorde|ring for|
|00000ec0| 20 69 6e 74 65 67 65 72 | 20 76 61 6c 75 65 73 20 | integer| values |
|00000ed0| 6c 6f 77 2f 68 69 67 68 | 20 65 6e 64 69 61 6e 20 |low/high| endian |
|00000ee0| 72 65 6f 72 64 65 72 69 | 6e 67 29 2e 0d a5 09 41 |reorderi|ng)....A|
|00000ef0| 20 73 74 72 65 61 6d 20 | 69 73 20 61 20 6e 6f 6e | stream |is a non|
|00000f00| 2d 70 6f 6c 79 6d 6f 72 | 70 68 69 63 20 65 6e 74 |-polymor|phic ent|
|00000f10| 69 74 79 20 74 68 61 74 | 20 63 6f 6e 6e 65 63 74 |ity that| connect|
|00000f20| 73 20 61 20 73 69 6e 6b | 20 74 6f 20 61 20 66 6f |s a sink| to a fo|
|00000f30| 72 6d 61 74 74 65 72 2e | 20 54 68 65 20 53 74 72 |rmatter.| The Str|
|00000f40| 65 61 6d 73 20 63 6f 6d | 70 6f 6e 65 6e 74 20 69 |eams com|ponent i|
|00000f50| 6e 63 6c 75 64 65 73 20 | 72 65 61 64 61 62 6c 65 |ncludes |readable|
|00000f60| 20 61 6e 64 20 77 72 69 | 74 61 62 6c 65 20 73 74 | and wri|table st|
|00000f70| 72 65 61 6d 20 63 6c 61 | 73 73 65 73 2e 20 41 20 |ream cla|sses. A |
|00000f80| 72 65 61 64 61 62 6c 65 | 20 73 74 72 65 61 6d 20 |readable| stream |
|00000f90| 63 6f 6e 6e 65 63 74 73 | 20 61 20 73 69 6e 6b 20 |connects| a sink |
|00000fa0| 74 6f 20 61 20 72 65 61 | 64 61 62 6c 65 20 66 6f |to a rea|dable fo|
|00000fb0| 72 6d 61 74 74 65 72 20 | 61 6e 64 20 61 20 77 72 |rmatter |and a wr|
|00000fc0| 69 74 61 62 6c 65 20 73 | 74 72 65 61 6d 20 63 6f |itable s|tream co|
|00000fd0| 6e 6e 65 63 74 73 20 61 | 20 73 69 6e 6b 20 74 6f |nnects a| sink to|
|00000fe0| 20 61 20 77 72 69 74 61 | 62 6c 65 20 66 6f 72 6d | a writa|ble form|
|00000ff0| 61 74 74 65 72 2e 0d 0d | 49 6e 20 4f 50 46 2c 20 |atter...|In OPF, |
|00001000| 74 68 65 20 63 72 65 61 | 74 6f 72 20 6f 66 20 61 |the crea|tor of a|
|00001010| 20 73 74 72 65 61 6d 20 | 73 70 65 63 69 66 69 65 | stream |specifie|
|00001020| 73 20 74 68 65 20 73 69 | 6e 6b 20 61 6e 64 20 73 |s the si|nk and s|
|00001030| 74 72 65 61 6d 20 66 6f | 72 6d 61 74 74 65 72 20 |tream fo|rmatter |
|00001040| 66 6f 72 20 74 68 61 74 | 20 73 74 72 65 61 6d 2e |for that| stream.|
|00001050| 20 54 68 69 73 20 6d 61 | 6b 65 73 20 74 68 65 20 | This ma|kes the |
|00001060| 63 72 65 61 74 6f 72 20 | 6f 66 20 74 68 65 20 73 |creator |of the s|
|00001070| 74 72 65 61 6d 20 72 65 | 73 70 6f 6e 73 69 62 6c |tream re|sponsibl|
|00001080| 65 20 66 6f 72 20 74 68 | 65 20 73 6f 75 72 63 65 |e for th|e source|
|00001090| 20 6f 72 20 64 65 73 74 | 69 6e 61 74 69 6f 6e 20 | or dest|ination |
|000010a0| 6f 66 20 74 68 65 20 73 | 74 72 65 61 6d 27 73 20 |of the s|tream's |
|000010b0| 64 61 74 61 20 28 74 68 | 65 20 73 69 6e 6b 29 2c |data (th|e sink),|
|000010c0| 20 61 6e 64 20 68 6f 77 | 20 74 68 65 20 64 61 74 | and how| the dat|
|000010d0| 61 20 69 73 20 66 6f 72 | 6d 61 74 74 65 64 20 28 |a is for|matted (|
|000010e0| 74 68 65 20 73 74 72 65 | 61 6d 20 66 6f 72 6d 61 |the stre|am forma|
|000010f0| 74 74 65 72 29 2e 0d 0d | 49 6e 20 4f 50 46 2c 20 |tter)...|In OPF, |
|00001100| 74 68 65 20 63 6c 69 65 | 6e 74 20 6f 66 20 61 20 |the clie|nt of a |
|00001110| 73 74 72 65 61 6d 20 63 | 61 6e 20 72 65 61 64 20 |stream c|an read |
|00001120| 6f 72 20 77 72 69 74 65 | 20 64 61 74 61 20 74 6f |or write| data to|
|00001130| 20 74 68 65 20 73 74 72 | 65 61 6d 2c 20 62 75 74 | the str|eam, but|
|00001140| 20 63 61 6e 20 6e 6f 74 | 20 61 63 63 65 73 73 20 | can not| access |
|00001150| 74 6f 20 73 69 6e 6b 20 | 6f 72 20 66 6f 72 6d 61 |to sink |or forma|
|00001160| 74 74 65 72 20 63 6f 6e | 6e 65 63 74 65 64 20 74 |tter con|nected t|
|00001170| 6f 20 74 68 61 74 20 73 | 74 72 65 61 6d 2e 20 54 |o that s|tream. T|
|00001180| 68 65 72 65 66 6f 72 65 | 2c 20 73 74 72 65 61 6d |herefore|, stream|
|00001190| 20 63 6c 69 65 6e 74 20 | 63 6f 6e 74 72 6f 6c 73 | client |controls|
|000011a0| 20 6e 65 69 74 68 65 72 | 20 74 68 65 20 73 6f 75 | neither| the sou|
|000011b0| 72 63 65 20 6f 72 20 74 | 68 65 20 64 65 73 74 69 |rce or t|he desti|
|000011c0| 6e 61 74 69 6f 6e 20 6f | 66 20 74 68 65 20 64 61 |nation o|f the da|
|000011d0| 74 61 20 6e 6f 72 20 68 | 6f 77 20 74 68 65 20 64 |ta nor h|ow the d|
|000011e0| 61 74 61 20 69 73 20 66 | 6f 72 6d 61 74 74 65 64 |ata is f|ormatted|
|000011f0| 2e 0d 53 74 72 65 61 6d | 73 20 3c 3c 20 61 6e 64 |..Stream|s << and|
|00001200| 20 3e 3e 20 6f 70 65 72 | 61 74 6f 72 73 0d 52 65 | >> oper|ators.Re|
|00001210| 61 64 61 62 6c 65 20 61 | 6e 64 20 77 72 69 74 61 |adable a|nd writa|
|00001220| 62 6c 65 20 73 74 72 65 | 61 6d 73 20 63 6c 61 73 |ble stre|ams clas|
|00001230| 73 65 73 20 6f 76 65 72 | 6c 6f 61 64 20 74 68 65 |ses over|load the|
|00001240| 20 6f 70 65 72 61 74 6f | 72 73 20 3c 3c 20 61 6e | operato|rs << an|
|00001250| 64 20 3e 3e 20 66 6f 72 | 20 61 6c 6c 20 62 75 69 |d >> for| all bui|
|00001260| 6c 74 2d 69 6e 20 64 61 | 74 61 20 74 79 70 65 73 |lt-in da|ta types|
|00001270| 2e 20 0d 59 6f 75 20 61 | 72 65 20 72 65 73 70 6f |. .You a|re respo|
|00001280| 6e 73 69 62 6c 65 20 66 | 6f 72 20 64 65 66 69 6e |nsible f|or defin|
|00001290| 69 6e 67 20 3c 3c 20 61 | 6e 64 20 3e 3e 20 6f 70 |ing << a|nd >> op|
|000012a0| 65 72 61 74 6f 72 73 20 | 74 6f 20 73 74 72 65 61 |erators |to strea|
|000012b0| 6d 20 79 6f 75 72 20 6f | 77 6e 20 75 73 65 72 2d |m your o|wn user-|
|000012c0| 64 65 66 69 6e 65 64 20 | 74 79 70 65 73 2e 0d 53 |defined |types..S|
|000012d0| 74 72 65 61 6d 73 20 61 | 73 20 6c 69 67 68 74 77 |treams a|s lightw|
|000012e0| 65 69 67 68 74 20 6f 62 | 6a 65 63 74 73 0d 4f 6e |eight ob|jects.On|
|000012f0| 63 65 20 79 6f 75 20 63 | 72 65 61 74 65 20 61 20 |ce you c|reate a |
|00001300| 4f 50 46 20 73 74 72 65 | 61 6d 2c 20 79 6f 75 20 |OPF stre|am, you |
|00001310| 63 61 6e 6e 6f 74 20 63 | 68 61 6e 67 65 20 69 74 |cannot c|hange it|
|00001320| 73 20 73 69 6e 6b 20 6f | 72 20 66 6f 72 6d 61 74 |s sink o|r format|
|00001330| 74 65 72 2e 20 49 6e 73 | 74 65 61 64 2c 20 79 6f |ter. Ins|tead, yo|
|00001340| 75 20 63 72 65 61 74 65 | 20 61 20 6e 65 77 20 73 |u create| a new s|
|00001350| 74 72 65 61 6d 20 77 69 | 74 68 20 61 20 6e 65 77 |tream wi|th a new|
|00001360| 20 73 69 6e 6b 20 61 6e | 64 20 66 6f 72 6d 61 74 | sink an|d format|
|00001370| 74 65 72 2e 20 74 68 69 | 73 20 69 73 20 61 6e 20 |ter. thi|s is an |
|00001380| 69 6e 65 78 70 65 6e 73 | 69 76 65 20 6f 70 65 72 |inexpens|ive oper|
|00001390| 61 74 69 6f 6e 20 62 65 | 63 61 75 73 65 20 73 74 |ation be|cause st|
|000013a0| 72 65 61 6d 73 20 63 6c | 61 73 73 65 73 20 61 72 |reams cl|asses ar|
|000013b0| 65 20 6c 69 67 68 74 77 | 65 69 67 68 74 20 63 6c |e lightw|eight cl|
|000013c0| 61 73 73 65 73 2e 20 0d | 54 6f 20 75 73 65 20 61 |asses. .|To use a|
|000013d0| 20 73 74 72 65 61 6d 2c | 20 79 6f 75 20 6d 75 73 | stream,| you mus|
|000013e0| 74 20 64 65 63 69 64 65 | 20 77 68 6f 20 d2 63 72 |t decide| who .cr|
|000013f0| 65 61 74 65 73 d3 20 74 | 68 65 20 73 74 72 65 61 |eates. t|he strea|
|00001400| 6d 20 61 6e 64 20 77 68 | 6f 20 69 73 20 61 20 d2 |m and wh|o is a .|
|00001410| 63 6c 69 65 6e 74 d3 20 | 6f 66 20 74 68 65 20 73 |client. |of the s|
|00001420| 74 72 65 61 6d 2e 20 41 | 20 73 74 72 65 61 6d 20 |tream. A| stream |
|00001430| 63 72 65 61 74 6f 72 20 | 68 61 73 20 6b 6e 6f 77 |creator |has know|
|00001440| 6c 65 64 67 65 20 6f 66 | 20 74 68 65 20 73 6f 75 |ledge of| the sou|
|00001450| 72 63 65 20 6f 72 20 64 | 65 73 74 69 6e 61 74 69 |rce or d|estinati|
|00001460| 6f 6e 20 6f 66 20 74 68 | 65 20 73 74 72 65 61 6d |on of th|e stream|
|00001470| 20 64 61 74 61 20 61 6e | 64 20 68 6f 77 20 74 68 | data an|d how th|
|00001480| 65 20 64 61 74 61 20 69 | 73 20 66 6f 72 6d 61 74 |e data i|s format|
|00001490| 74 65 64 2e 20 41 20 73 | 74 72 65 61 6d 20 63 6c |ted. A s|tream cl|
|000014a0| 69 65 6e 74 20 68 61 73 | 20 6f 6e 6c 79 20 74 68 |ient has| only th|
|000014b0| 65 20 6b 6e 6f 77 6c 65 | 64 67 65 20 6f 66 20 74 |e knowle|dge of t|
|000014c0| 68 65 20 64 61 74 61 20 | 69 74 20 69 73 20 72 65 |he data |it is re|
|000014d0| 73 70 6f 6e 73 69 62 6c | 65 20 66 6f 72 20 72 65 |sponsibl|e for re|
|000014e0| 61 64 69 6e 67 20 6f 72 | 20 77 72 69 74 69 6e 67 |ading or| writing|
|000014f0| 20 74 6f 20 74 68 65 20 | 73 74 72 65 61 6d 2e 0d | to the |stream..|
|00001500| 53 74 72 65 61 6d 73 20 | 63 6f 6d 70 6f 6e 65 6e |Streams |componen|
|00001510| 74 20 64 65 73 69 67 6e | 0d 54 68 65 20 53 74 72 |t design|.The Str|
|00001520| 65 61 6d 73 20 43 6f 6d | 70 6f 6e 65 6e 74 20 73 |eams Com|ponent s|
|00001530| 65 70 61 72 61 74 65 73 | 20 74 68 65 20 72 65 73 |eparates| the res|
|00001540| 70 6f 6e 73 69 62 69 6c | 69 74 79 20 66 6f 72 20 |ponsibil|ity for |
|00001550| 73 74 72 65 61 6d 69 6e | 67 20 74 68 65 20 64 61 |streamin|g the da|
|00001560| 74 61 20 28 72 65 61 64 | 69 6e 67 20 69 6e 20 6f |ta (read|ing in o|
|00001570| 72 20 77 72 69 74 69 6e | 67 20 6f 75 74 20 74 68 |r writin|g out th|
|00001580| 65 20 64 61 74 61 29 20 | 66 72 6f 6d 20 74 68 65 |e data) |from the|
|00001590| 20 72 65 73 70 6f 6e 73 | 69 62 69 6c 69 74 79 20 | respons|ibility |
|000015a0| 66 6f 72 20 64 65 74 65 | 72 6d 69 6e 69 6e 67 20 |for dete|rmining |
|000015b0| 74 68 65 20 6c 6f 63 61 | 74 69 6f 6e 20 61 6e 64 |the loca|tion and|
|000015c0| 20 66 6f 72 6d 61 74 20 | 6f 66 20 74 68 65 20 64 | format |of the d|
|000015d0| 61 74 61 20 28 77 68 65 | 72 65 20 74 68 65 20 64 |ata (whe|re the d|
|000015e0| 61 74 61 20 61 63 74 75 | 61 6c 6c 79 20 65 6e 64 |ata actu|ally end|
|000015f0| 73 20 75 70 20 61 6e 64 | 20 68 6f 77 20 69 74 20 |s up and| how it |
|00001600| 6c 6f 6f 6b 73 29 2e 20 | 0d 54 68 65 20 63 72 65 |looks). |.The cre|
|00001610| 61 74 6f 72 20 6f 66 20 | 61 20 73 74 72 65 61 6d |ator of |a stream|
|00001620| 20 64 65 74 65 72 6d 69 | 6e 65 73 20 74 68 65 20 | determi|nes the |
|00001630| 6c 6f 63 61 74 69 6f 6e | 20 61 6e 64 20 66 6f 72 |location| and for|
|00001640| 6d 61 74 20 6f 66 20 64 | 61 74 61 20 74 6f 20 62 |mat of d|ata to b|
|00001650| 65 20 73 74 72 65 61 6d | 65 64 2e 20 54 68 65 20 |e stream|ed. The |
|00001660| 63 72 65 61 74 6f 72 20 | 64 65 74 65 72 6d 69 6e |creator |determin|
|00001670| 65 73 20 6c 6f 63 61 74 | 69 6f 6e 20 61 6e 64 20 |es locat|ion and |
|00001680| 66 6f 72 6d 61 74 20 62 | 79 20 73 70 65 63 69 66 |format b|y specif|
|00001690| 79 69 6e 67 20 61 20 73 | 69 6e 6b 2c 20 61 6e 64 |ying a s|ink, and|
|000016a0| 2c 20 6f 70 74 69 6f 6e | 61 6c 6c 79 2c 20 61 20 |, option|ally, a |
|000016b0| 73 74 72 65 61 6d 20 66 | 6f 72 6d 61 74 74 65 72 |stream f|ormatter|
|000016c0| 2e 0d 54 68 65 20 63 6c | 69 65 6e 74 20 6f 66 20 |..The cl|ient of |
|000016d0| 61 20 73 74 72 65 61 6d | 20 69 73 20 72 65 73 70 |a stream| is resp|
|000016e0| 6f 6e 73 69 62 6c 65 20 | 66 6f 72 20 73 74 72 65 |onsible |for stre|
|000016f0| 61 6d 69 6e 67 20 74 68 | 65 20 64 61 74 61 2e 20 |aming th|e data. |
|00001700| 54 68 65 20 63 6c 69 65 | 6e 74 20 64 6f 65 73 20 |The clie|nt does |
|00001710| 6e 6f 74 20 68 61 76 65 | 20 61 63 63 65 73 73 20 |not have| access |
|00001720| 74 6f 20 74 68 65 20 73 | 74 72 65 61 6d 27 73 20 |to the s|tream's |
|00001730| 73 69 6e 6b 20 61 6e 64 | 20 73 74 72 65 61 6d 20 |sink and| stream |
|00001740| 66 6f 72 6d 61 74 74 65 | 72 2e 0d 45 72 72 6f 72 |formatte|r..Error|
|00001750| 20 68 61 6e 64 6c 69 6e | 67 0d 54 68 65 20 53 74 | handlin|g.The St|
|00001760| 72 65 61 6d 73 20 43 6f | 6d 70 6f 6e 65 6e 74 20 |reams Co|mponent |
|00001770| 64 65 73 69 67 6e 20 64 | 6f 65 73 20 6e 6f 74 20 |design d|oes not |
|00001780| 72 65 71 75 69 72 65 20 | 74 68 65 20 73 74 72 65 |require |the stre|
|00001790| 61 6d 20 63 6c 69 65 6e | 74 20 74 6f 20 63 68 65 |am clien|t to che|
|000017a0| 63 6b 20 66 6f 72 20 61 | 20 73 75 63 63 65 73 73 |ck for a| success|
|000017b0| 66 75 6c 20 64 61 74 61 | 20 69 6e 74 65 72 63 68 |ful data| interch|
|000017c0| 61 6e 67 65 20 61 66 74 | 65 72 20 65 61 63 68 20 |ange aft|er each |
|000017d0| 49 4f 20 6f 70 65 72 61 | 74 69 6f 6e 2e 20 49 74 |IO opera|tion. It|
|000017e0| 20 61 6c 73 6f 20 64 6f | 65 73 20 6e 6f 74 20 72 | also do|es not r|
|000017f0| 65 71 75 69 72 65 20 74 | 68 65 20 63 6f 6d 70 6f |equire t|he compo|
|00001800| 6e 65 6e 74 20 74 6f 20 | 63 61 72 72 79 20 74 68 |nent to |carry th|
|00001810| 65 20 65 72 72 6f 72 20 | 73 74 61 74 65 2c 20 6e |e error |state, n|
|00001820| 6f 72 20 64 6f 65 73 20 | 69 74 20 70 72 6f 76 69 |or does |it provi|
|00001830| 64 65 20 74 68 65 20 69 | 6e 74 65 72 66 61 63 65 |de the i|nterface|
|00001840| 20 6e 65 63 65 73 73 61 | 72 79 20 74 6f 20 61 63 | necessa|ry to ac|
|00001850| 63 65 73 73 20 74 68 61 | 74 20 65 72 72 6f 72 20 |cess tha|t error |
|00001860| 73 74 61 74 65 2e 0d 54 | 68 65 72 65 66 6f 72 65 |state..T|herefore|
|00001870| 2c 20 4f 50 46 20 73 74 | 72 65 61 6d 73 20 64 6f |, OPF st|reams do|
|00001880| 20 6e 6f 74 20 63 61 72 | 72 79 20 65 72 72 6f 72 | not car|ry error|
|00001890| 20 73 74 61 74 65 20 69 | 6e 66 6f 72 6d 61 74 69 | state i|nformati|
|000018a0| 6f 6e 2e 20 45 72 72 6f | 72 73 20 61 72 65 20 63 |on. Erro|rs are c|
|000018b0| 6f 6d 6d 75 6e 69 63 61 | 74 65 64 20 74 6f 20 61 |ommunica|ted to a|
|000018c0| 20 72 65 61 64 61 62 6c | 65 20 6f 72 20 77 72 69 | readabl|e or wri|
|000018d0| 74 61 62 6c 65 20 73 74 | 72 65 61 6d 20 76 69 61 |table st|ream via|
|000018e0| 20 61 6e 20 65 78 63 65 | 70 74 69 6f 6e 2e 20 54 | an exce|ption. T|
|000018f0| 68 69 73 20 61 6c 6c 6f | 77 73 20 74 68 65 20 75 |his allo|ws the u|
|00001900| 73 65 72 20 6f 66 20 4f | 50 46 20 73 74 72 65 61 |ser of O|PF strea|
|00001910| 6d 73 20 74 6f 20 6d 6f | 76 65 20 74 68 65 20 72 |ms to mo|ve the r|
|00001920| 65 73 70 6f 6e 73 69 62 | 69 6c 69 74 79 20 66 6f |esponsib|ility fo|
|00001930| 72 20 65 72 72 6f 72 20 | 68 61 6e 64 6c 69 6e 67 |r error |handling|
|00001940| 20 74 6f 20 61 20 68 69 | 67 68 65 72 20 6c 65 76 | to a hi|gher lev|
|00001950| 65 6c 20 2d 2d 20 70 65 | 72 68 61 70 73 20 74 6f |el -- pe|rhaps to|
|00001960| 20 74 68 65 20 65 6e 74 | 69 74 79 20 72 65 73 70 | the ent|ity resp|
|00001970| 6f 6e 73 69 62 6c 65 20 | 66 6f 72 20 63 72 65 61 |onsible |for crea|
|00001980| 74 69 6e 67 20 74 68 65 | 20 73 74 72 65 61 6d 2c |ting the| stream,|
|00001990| 20 61 6e 64 20 6e 6f 74 | 20 74 6f 20 65 61 63 68 | and not| to each|
|000019a0| 20 63 6c 69 65 6e 74 20 | 6f 66 20 74 68 65 20 73 | client |of the s|
|000019b0| 74 72 65 61 6d 2e 0d 43 | 2b 2b 20 49 4f 53 74 72 |tream..C|++ IOStr|
|000019c0| 65 61 6d 73 20 43 6c 61 | 73 73 20 4c 69 62 72 61 |eams Cla|ss Libra|
|000019d0| 72 79 20 76 65 72 73 75 | 73 20 4f 50 46 20 53 74 |ry versu|s OPF St|
|000019e0| 72 65 61 6d 73 0d 54 68 | 65 20 49 4f 53 74 72 65 |reams.Th|e IOStre|
|000019f0| 61 6d 73 20 63 6c 61 73 | 73 20 6c 69 62 72 61 72 |ams clas|s librar|
|00001a00| 79 20 66 6f 6c 6c 6f 77 | 73 20 6e 65 69 74 68 65 |y follow|s neithe|
|00001a10| 72 20 74 68 65 20 73 65 | 70 61 72 61 74 69 6f 6e |r the se|paration|
|00001a20| 20 6f 66 20 72 65 73 70 | 6f 6e 73 69 62 69 6c 69 | of resp|onsibili|
|00001a30| 74 69 65 73 20 6e 6f 72 | 20 74 68 65 20 65 72 72 |ties nor| the err|
|00001a40| 6f 72 20 68 61 6e 64 6c | 69 6e 67 20 6d 65 63 68 |or handl|ing mech|
|00001a50| 61 6e 69 73 6d 73 20 6f | 66 20 74 68 65 20 4f 50 |anisms o|f the OP|
|00001a60| 46 20 53 74 72 65 61 6d | 73 20 43 6f 6d 70 6f 6e |F Stream|s Compon|
|00001a70| 65 6e 74 2e 20 0d 41 64 | 64 69 74 69 6f 6e 61 6c |ent. .Ad|ditional|
|00001a80| 6c 79 2c 20 73 69 6e 63 | 65 20 63 6c 69 65 6e 74 |ly, sinc|e client|
|00001a90| 73 20 6f 66 20 4f 50 46 | 20 73 74 72 65 61 6d 73 |s of OPF| streams|
|00001aa0| 20 64 6f 20 6e 6f 74 20 | 66 6f 72 6d 61 74 20 74 | do not |format t|
|00001ab0| 68 65 20 64 61 74 61 20 | 62 65 69 6e 67 20 73 74 |he data |being st|
|00001ac0| 72 65 61 6d 65 64 2c 20 | 74 68 65 20 4f 50 46 20 |reamed, |the OPF |
|00001ad0| 53 74 72 65 61 6d 73 20 | 43 6f 6d 70 6f 6e 65 6e |Streams |Componen|
|00001ae0| 74 20 64 6f 65 73 20 6e | 6f 74 20 73 75 70 70 6f |t does n|ot suppo|
|00001af0| 72 74 20 74 68 65 20 6d | 61 6e 69 70 75 6c 61 74 |rt the m|anipulat|
|00001b00| 6f 72 73 20 70 72 6f 76 | 69 64 65 64 20 62 79 20 |ors prov|ided by |
|00001b10| 43 2b 2b 20 49 4f 53 74 | 72 65 61 6d 73 20 63 6c |C++ IOSt|reams cl|
|00001b20| 61 73 73 20 6c 69 62 72 | 61 72 79 2e 0d 44 65 63 |ass libr|ary..Dec|
|00001b30| 69 64 69 6e 67 20 62 65 | 74 77 65 65 6e 20 43 2b |iding be|tween C+|
|00001b40| 2b 20 49 4f 53 74 72 65 | 61 6d 73 20 61 6e 64 20 |+ IOStre|ams and |
|00001b50| 4f 50 46 20 73 74 72 65 | 61 6d 73 20 0d 43 2b 2b |OPF stre|ams .C++|
|00001b60| 20 49 4f 53 74 72 65 61 | 6d 73 20 61 6e 64 20 4f | IOStrea|ms and O|
|00001b70| 50 46 20 53 74 72 65 61 | 6d 73 20 61 72 65 20 63 |PF Strea|ms are c|
|00001b80| 6f 6d 70 61 74 69 62 6c | 65 2e 20 59 6f 75 20 63 |ompatibl|e. You c|
|00001b90| 61 6e 20 63 6f 6e 74 69 | 6e 75 65 20 74 6f 20 75 |an conti|nue to u|
|00001ba0| 73 65 20 79 6f 75 72 20 | 49 4f 53 74 72 65 61 6d |se your |IOStream|
|00001bb0| 73 20 70 61 63 6b 61 67 | 65 3b 20 54 68 65 20 70 |s packag|e; The p|
|00001bc0| 72 65 64 65 66 69 6e 65 | 64 20 73 74 72 65 61 6d |redefine|d stream|
|00001bd0| 73 20 70 72 6f 76 69 64 | 65 64 20 77 69 74 68 20 |s provid|ed with |
|00001be0| 49 4f 53 74 72 65 61 6d | 73 20 61 72 65 20 76 65 |IOStream|s are ve|
|00001bf0| 72 79 20 68 61 6e 64 79 | 20 66 6f 72 20 64 65 62 |ry handy| for deb|
|00001c00| 75 67 67 69 6e 67 20 70 | 75 72 70 6f 73 65 73 2e |ugging p|urposes.|
|00001c10| 0d 57 68 65 6e 20 79 6f | 75 72 20 73 74 72 65 61 |.When yo|ur strea|
|00001c20| 6d 20 63 6c 69 65 6e 74 | 20 64 6f 65 73 20 6e 6f |m client| does no|
|00001c30| 74 20 6e 65 65 64 20 74 | 6f 20 6b 6e 6f 77 20 68 |t need t|o know h|
|00001c40| 6f 77 20 74 6f 20 66 6f | 72 6d 61 74 20 74 68 65 |ow to fo|rmat the|
|00001c50| 20 64 61 74 61 20 62 65 | 69 6e 67 20 73 74 72 65 | data be|ing stre|
|00001c60| 61 6d 65 64 2c 20 75 73 | 65 20 4f 50 46 20 73 74 |amed, us|e OPF st|
|00001c70| 72 65 61 6d 73 2e 20 49 | 66 20 6e 6f 74 3b 20 74 |reams. I|f not; t|
|00001c80| 68 65 6e 20 79 6f 75 20 | 6d 75 73 74 20 64 65 74 |hen you |must det|
|00001c90| 65 72 6d 69 6e 65 20 77 | 68 79 20 74 68 65 20 73 |ermine w|hy the s|
|00001ca0| 74 72 65 61 6d 20 63 6c | 69 65 6e 74 20 6e 65 65 |tream cl|ient nee|
|00001cb0| 64 73 20 74 6f 20 66 6f | 72 6d 61 74 20 74 68 65 |ds to fo|rmat the|
|00001cc0| 20 64 61 74 61 2e 0d 59 | 6f 75 20 63 61 6e 20 75 | data..Y|ou can u|
|00001cd0| 73 65 20 4f 50 46 20 73 | 74 72 65 61 6d 73 20 66 |se OPF s|treams f|
|00001ce0| 6f 72 20 64 65 62 75 67 | 67 69 6e 67 20 70 75 72 |or debug|ging pur|
|00001cf0| 70 6f 73 65 73 2e 20 46 | 6f 72 20 65 78 61 6d 70 |poses. F|or examp|
|00001d00| 6c 65 2c 20 69 6d 61 67 | 69 6e 65 20 79 6f 75 72 |le, imag|ine your|
|00001d10| 20 70 61 72 74 20 63 72 | 65 61 74 65 73 20 61 20 | part cr|eates a |
|00001d20| 64 6f 63 75 6d 65 6e 74 | 20 66 69 6c 65 2e 20 59 |document| file. Y|
|00001d30| 6f 75 20 63 72 65 61 74 | 65 20 61 20 77 72 69 74 |ou creat|e a writ|
|00001d40| 61 62 6c 65 20 73 74 72 | 65 61 6d 20 66 6f 72 6d |able str|eam form|
|00001d50| 61 74 74 65 72 20 74 68 | 61 74 20 74 72 61 6e 73 |atter th|at trans|
|00001d60| 6c 61 74 65 73 20 61 6c | 6c 20 74 68 65 20 64 61 |lates al|l the da|
|00001d70| 74 61 20 69 74 20 72 65 | 63 65 69 76 65 73 20 74 |ta it re|ceives t|
|00001d80| 6f 20 41 53 43 49 49 20 | 74 65 78 74 2e 20 41 64 |o ASCII |text. Ad|
|00001d90| 64 69 74 69 6f 6e 61 6c | 6c 79 2c 20 65 61 63 68 |ditional|ly, each|
|00001da0| 20 72 65 71 75 65 73 74 | 20 72 65 63 65 69 76 65 | request| receive|
|00001db0| 64 20 62 79 20 74 68 65 | 20 66 6f 72 6d 61 74 74 |d by the| formatt|
|00001dc0| 65 72 20 72 65 73 75 6c | 74 73 20 69 6e 20 61 6e |er resul|ts in an|
|00001dd0| 20 41 53 43 49 49 20 74 | 65 78 74 20 68 65 61 64 | ASCII t|ext head|
|00001de0| 65 72 20 62 65 69 6e 67 | 20 67 65 6e 65 72 61 74 |er being| generat|
|00001df0| 65 64 20 28 66 6f 72 20 | 65 78 61 6d 70 6c 65 2c |ed (for |example,|
|00001e00| 20 d2 34 20 75 6e 73 69 | 67 6e 65 64 20 6c 6f 6e | .4 unsi|gned lon|
|00001e10| 67 73 20 66 6f 6c 6c 6f | 77 d3 29 2e 20 41 20 64 |gs follo|w.). A d|
|00001e20| 65 62 75 67 20 76 65 72 | 73 69 6f 6e 20 6f 66 20 |ebug ver|sion of |
|00001e30| 79 6f 75 72 20 70 72 6f | 67 72 61 6d 20 77 6f 75 |your pro|gram wou|
|00001e40| 6c 64 20 75 73 65 20 74 | 68 69 73 20 73 70 65 63 |ld use t|his spec|
|00001e50| 69 61 6c 2c 20 41 53 43 | 49 49 2d 67 65 6e 65 72 |ial, ASC|II-gener|
|00001e60| 61 74 69 6e 67 2c 20 77 | 72 69 74 61 62 6c 65 20 |ating, w|ritable |
|00001e70| 73 74 72 65 61 6d 20 66 | 6f 72 6d 61 74 74 65 72 |stream f|ormatter|
|00001e80| 20 61 74 20 74 68 65 20 | 70 6f 69 6e 74 20 77 68 | at the |point wh|
|00001e90| 65 72 65 20 79 6f 75 20 | 63 72 65 61 74 65 20 74 |ere you |create t|
|00001ea0| 68 65 20 77 72 69 74 61 | 62 6c 65 20 73 74 72 65 |he writa|ble stre|
|00001eb0| 61 6d 20 61 73 73 6f 63 | 69 61 74 65 64 20 77 69 |am assoc|iated wi|
|00001ec0| 74 68 20 79 6f 75 72 20 | 64 6f 63 75 6d 65 6e 74 |th your |document|
|00001ed0| 20 66 69 6c 65 2e 20 42 | 79 20 63 68 61 6e 67 69 | file. B|y changi|
|00001ee0| 6e 67 20 74 68 69 73 20 | 6f 6e 65 20 6c 6f 63 61 |ng this |one loca|
|00001ef0| 74 69 6f 6e 2c 20 61 6c | 6c 20 74 68 65 20 64 61 |tion, al|l the da|
|00001f00| 74 61 20 79 6f 75 20 77 | 72 69 74 65 20 74 6f 20 |ta you w|rite to |
|00001f10| 74 68 65 20 64 6f 63 75 | 6d 65 6e 74 20 66 69 6c |the docu|ment fil|
|00001f20| 65 20 69 73 20 6e 6f 77 | 20 69 6e 20 41 53 43 49 |e is now| in ASCI|
|00001f30| 49 2e 0d 43 6f 6d 70 6f | 6e 65 6e 74 20 64 65 70 |I..Compo|nent dep|
|00001f40| 65 6e 64 65 6e 63 69 65 | 73 0d 54 68 65 20 53 74 |endencie|s.The St|
|00001f50| 72 65 61 6d 73 20 63 6f | 6d 70 6f 6e 65 6e 74 20 |reams co|mponent |
|00001f60| 64 65 70 65 6e 64 73 20 | 75 70 6f 6e 20 74 68 65 |depends |upon the|
|00001f70| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 63 6f 6d 70 6f | followi|ng compo|
|00001f80| 6e 65 6e 74 73 3a 0d 46 | 57 43 6f 6d 6d 6f 6e 0d |nents:.F|WCommon.|
|00001f90| 46 57 54 61 73 6b 47 0d | 46 57 52 75 6e 74 79 70 |FWTaskG.|FWRuntyp|
|00001fa0| 0d 46 57 44 65 62 75 67 | 0d 46 57 45 78 63 4c 69 |.FWDebug|.FWExcLi|
|00001fb0| 62 0d 52 65 6c 61 74 65 | 64 20 63 6f 6d 70 6f 6e |b.Relate|d compon|
|00001fc0| 65 6e 74 73 3a 0d a5 09 | 54 68 65 20 66 69 6c 65 |ents:...|The file|
|00001fd0| 73 20 63 6f 6d 70 6f 6e | 65 6e 74 20 63 6f 6e 74 |s compon|ent cont|
|00001fe0| 61 69 6e 73 20 74 68 65 | 20 46 57 5f 43 46 69 6c |ains the| FW_CFil|
|00001ff0| 65 41 63 63 65 73 73 20 | 73 69 6e 6b 2e 0d a5 09 |eAccess |sink....|
|00002000| 54 68 65 20 52 65 73 6f | 75 72 63 65 73 20 63 6f |The Reso|urces co|
|00002010| 6d 70 6f 6e 65 6e 74 20 | 63 6f 6e 74 61 69 6e 73 |mponent |contains|
|00002020| 20 46 57 5f 43 52 65 73 | 6f 75 72 63 65 53 69 6e | FW_CRes|ourceSin|
|00002030| 6b 2e 20 0d a5 09 54 68 | 65 20 41 72 63 68 69 76 |k. ...Th|e Archiv|
|00002040| 65 72 20 63 6f 6d 70 6f | 6e 65 6e 74 20 64 65 66 |er compo|nent def|
|00002050| 69 6e 65 73 20 46 57 5f | 43 52 65 61 64 61 62 6c |ines FW_|CReadabl|
|00002060| 65 2d 41 72 63 68 69 76 | 65 2c 20 61 20 73 75 62 |e-Archiv|e, a sub|
|00002070| 63 6c 61 73 73 20 6f 66 | 20 46 57 5f 43 52 65 61 |class of| FW_CRea|
|00002080| 64 61 62 6c 65 53 74 72 | 65 61 6d 2c 20 61 6e 64 |dableStr|eam, and|
|00002090| 20 46 57 5f 43 57 72 69 | 74 61 62 6c 65 41 72 63 | FW_CWri|tableArc|
|000020a0| 68 69 76 65 2c 20 61 20 | 73 75 62 63 6c 61 73 73 |hive, a |subclass|
|000020b0| 20 6f 66 20 46 57 5f 43 | 57 72 69 74 61 62 6c 65 | of FW_C|Writable|
|000020c0| 53 74 72 65 61 6d 2e 0d | 55 73 69 6e 67 20 74 68 |Stream..|Using th|
|000020d0| 65 20 53 74 72 65 61 6d | 73 20 43 6f 6d 70 6f 6e |e Stream|s Compon|
|000020e0| 65 6e 74 0d 54 68 65 20 | 73 74 72 65 61 6d 73 20 |ent.The |streams |
|000020f0| 6d 6f 64 65 6c 20 69 73 | 20 73 69 6d 70 6c 65 20 |model is| simple |
|00002100| 74 6f 20 63 6f 64 65 2e | 20 55 73 69 6e 67 20 74 |to code.| Using t|
|00002110| 68 65 20 73 61 6d 65 20 | 63 6f 64 65 20 69 6e 74 |he same |code int|
|00002120| 65 72 66 61 63 65 2c 20 | 79 6f 75 20 63 61 6e 20 |erface, |you can |
|00002130| 72 65 61 64 20 6f 72 20 | 77 72 69 74 65 20 64 61 |read or |write da|
|00002140| 74 61 20 6f 66 20 61 6e | 79 20 74 79 70 65 20 62 |ta of an|y type b|
|00002150| 65 74 77 65 65 6e 20 79 | 6f 75 72 20 70 72 6f 67 |etween y|our prog|
|00002160| 72 61 6d 20 61 6e 64 20 | 61 20 73 79 73 74 65 6d |ram and |a system|
|00002170| 20 64 65 76 69 63 65 20 | 73 75 70 70 6f 72 74 65 | device |supporte|
|00002180| 64 20 62 79 20 61 20 73 | 69 6e 6b 2e 0d 43 6f 64 |d by a s|ink..Cod|
|00002190| 69 6e 67 20 4f 76 65 72 | 76 69 65 77 0d 46 6f 6c |ing Over|view.Fol|
|000021a0| 6c 6f 77 20 74 68 65 20 | 73 74 65 70 73 20 6c 69 |low the |steps li|
|000021b0| 73 74 65 64 20 62 65 6c | 6f 77 20 77 68 65 6e 20 |sted bel|ow when |
|000021c0| 72 65 61 64 69 6e 67 20 | 6f 72 20 77 72 69 74 69 |reading |or writi|
|000021d0| 6e 67 20 64 61 74 61 20 | 74 6f 20 61 20 73 74 72 |ng data |to a str|
|000021e0| 65 61 6d 3a 20 0d 09 31 | 2e 09 49 6e 73 74 61 6e |eam: ..1|..Instan|
|000021f0| 74 69 61 74 65 20 61 20 | 73 69 6e 6b 73 20 6f 62 |tiate a |sinks ob|
|00002200| 6a 65 63 74 2e 20 45 69 | 74 68 65 72 20 69 6e 73 |ject. Ei|ther ins|
|00002210| 74 61 6e 74 69 61 74 65 | 20 6f 6e 65 20 6f 66 20 |tantiate| one of |
|00002220| 74 68 65 20 63 6f 6e 63 | 72 65 74 65 20 73 69 6e |the conc|rete sin|
|00002230| 6b 73 20 63 6c 61 73 73 | 65 73 20 70 72 6f 76 69 |ks class|es provi|
|00002240| 64 65 64 3b 20 6f 72 20 | 73 75 62 63 6c 61 73 73 |ded; or |subclass|
|00002250| 20 46 57 5f 43 53 69 6e | 6b 20 6f 72 20 46 57 5f | FW_CSin|k or FW_|
|00002260| 43 52 61 6e 64 6f 6d 41 | 63 63 65 73 73 53 69 6e |CRandomA|ccessSin|
|00002270| 6b 20 74 6f 20 73 75 70 | 70 6f 72 74 20 79 6f 75 |k to sup|port you|
|00002280| 72 20 6f 77 6e 20 64 65 | 76 69 63 65 2c 20 61 6e |r own de|vice, an|
|00002290| 64 20 69 6e 73 74 61 6e | 74 69 61 74 65 20 79 6f |d instan|tiate yo|
|000022a0| 75 72 20 6e 65 77 20 73 | 69 6e 6b 73 20 63 6c 61 |ur new s|inks cla|
|000022b0| 73 73 2e 0d 09 32 2e 09 | 49 66 20 6e 65 63 65 73 |ss...2..|If neces|
|000022c0| 73 61 72 79 2c 20 62 75 | 69 6c 64 20 61 20 66 6f |sary, bu|ild a fo|
|000022d0| 72 6d 61 74 74 65 72 20 | 63 6c 61 73 73 20 77 68 |rmatter |class wh|
|000022e0| 69 63 68 20 74 72 61 6e | 73 6c 61 74 65 73 20 64 |ich tran|slates d|
|000022f0| 61 74 61 20 66 72 6f 6d | 20 61 20 73 6f 75 72 63 |ata from| a sourc|
|00002300| 65 20 66 6f 72 6d 61 74 | 20 74 6f 20 61 20 74 61 |e format| to a ta|
|00002310| 72 67 65 74 20 66 6f 72 | 6d 61 74 2e 0d 09 33 2e |rget for|mat...3.|
|00002320| 09 49 6e 73 74 61 6e 74 | 69 61 74 65 20 74 68 65 |.Instant|iate the|
|00002330| 20 66 6f 72 6d 61 74 74 | 65 72 20 6f 62 6a 65 63 | formatt|er objec|
|00002340| 74 2e 0d 09 34 2e 09 49 | 6e 73 74 61 6e 74 69 61 |t...4..I|nstantia|
|00002350| 74 65 20 61 20 73 74 72 | 65 61 6d 73 20 6f 62 6a |te a str|eams obj|
|00002360| 65 63 74 20 62 79 20 70 | 61 73 73 69 6e 67 20 73 |ect by p|assing s|
|00002370| 69 6e 6b 20 61 6e 64 20 | 66 6f 72 6d 61 74 74 65 |ink and |formatte|
|00002380| 72 20 6f 62 6a 65 63 74 | 73 20 61 73 20 70 61 72 |r object|s as par|
|00002390| 61 6d 65 74 65 72 73 20 | 74 6f 20 74 68 65 20 73 |ameters |to the s|
|000023a0| 74 72 65 61 6d 20 6f 62 | 6a 65 63 74 20 63 6f 6e |tream ob|ject con|
|000023b0| 73 74 72 75 63 74 6f 72 | 2e 20 4f 50 46 20 63 72 |structor|. OPF cr|
|000023c0| 65 61 74 65 73 20 61 20 | 64 65 66 61 75 6c 74 20 |eates a |default |
|000023d0| 69 64 65 6e 74 69 74 79 | 20 66 6f 72 6d 61 74 74 |identity| formatt|
|000023e0| 65 72 20 69 66 20 79 6f | 75 20 64 6f 20 6e 6f 74 |er if yo|u do not|
|000023f0| 20 70 61 73 73 20 61 20 | 66 6f 72 6d 61 74 74 65 | pass a |formatte|
|00002400| 72 20 6f 62 6a 65 63 74 | 20 74 6f 20 74 68 65 20 |r object| to the |
|00002410| 73 74 72 65 61 6d 2e 0d | 09 35 2e 09 52 65 61 64 |stream..|.5..Read|
|00002420| 20 6f 72 20 77 72 69 74 | 65 20 64 61 74 61 20 75 | or writ|e data u|
|00002430| 73 69 6e 67 20 3e 3e 6f | 72 20 3c 3c 20 6f 70 65 |sing >>o|r << ope|
|00002440| 72 61 74 6f 72 73 2e 20 | 59 6f 75 20 6d 61 79 20 |rators. |You may |
|00002450| 75 73 65 20 6f 74 68 65 | 72 20 6d 65 74 68 6f 64 |use othe|r method|
|00002460| 73 20 70 72 6f 76 69 64 | 65 64 20 69 6e 20 74 68 |s provid|ed in th|
|00002470| 65 20 73 74 72 65 61 6d | 20 6f 62 6a 65 63 74 20 |e stream| object |
|00002480| 61 73 20 61 70 70 72 6f | 70 72 69 61 74 65 2e 0d |as appro|priate..|
|00002490| 49 6e 73 74 61 6e 74 69 | 61 74 69 6e 67 20 77 69 |Instanti|ating wi|
|000024a0| 74 68 69 6e 20 74 68 65 | 20 53 74 72 65 61 6d 73 |thin the| Streams|
|000024b0| 20 63 6f 6d 70 6f 6e 65 | 6e 74 0d 49 6e 73 74 61 | compone|nt.Insta|
|000024c0| 6e 74 69 61 74 65 20 61 | 20 73 69 6e 6b 73 20 6f |ntiate a| sinks o|
|000024d0| 62 6a 65 63 74 20 74 6f | 20 63 72 65 61 74 65 20 |bject to| create |
|000024e0| 61 20 63 6f 6e 6e 65 63 | 74 69 6f 6e 20 74 6f 20 |a connec|tion to |
|000024f0| 61 20 64 65 76 69 63 65 | 2e 20 49 6e 73 74 61 6e |a device|. Instan|
|00002500| 74 69 61 74 65 20 61 20 | 66 6f 72 6d 61 74 74 65 |tiate a |formatte|
|00002510| 72 20 6f 62 6a 65 63 74 | 20 74 6f 20 66 6f 72 6d |r object| to form|
|00002520| 61 74 20 74 68 65 20 64 | 61 74 61 2e 20 49 6e 73 |at the d|ata. Ins|
|00002530| 74 61 6e 74 69 61 74 65 | 20 61 20 53 74 72 65 61 |tantiate| a Strea|
|00002540| 6d 73 20 6f 62 6a 65 63 | 74 20 74 6f 20 63 6f 6e |ms objec|t to con|
|00002550| 6e 65 63 74 20 61 20 73 | 69 6e 6b 20 74 6f 20 61 |nect a s|ink to a|
|00002560| 20 66 6f 72 6d 61 74 74 | 65 72 2e 20 0d 53 75 62 | formatt|er. .Sub|
|00002570| 63 6c 61 73 73 69 6e 67 | 20 77 69 74 68 69 6e 20 |classing| within |
|00002580| 74 68 65 20 53 74 72 65 | 61 6d 73 20 63 6f 6d 70 |the Stre|ams comp|
|00002590| 6f 6e 65 6e 74 0d 53 75 | 62 63 6c 61 73 73 20 61 |onent.Su|bclass a|
|000025a0| 20 66 6f 72 6d 61 74 74 | 65 72 20 63 6c 61 73 73 | formatt|er class|
|000025b0| 20 74 6f 20 63 72 65 61 | 74 65 20 61 20 63 75 73 | to crea|te a cus|
|000025c0| 74 6f 6d 20 66 6f 72 6d | 61 74 74 65 72 2c 20 77 |tom form|atter, w|
|000025d0| 68 69 63 68 20 70 72 6f | 76 69 64 65 73 20 61 20 |hich pro|vides a |
|000025e0| 63 75 73 74 6f 6d 20 64 | 61 74 61 20 74 72 61 6e |custom d|ata tran|
|000025f0| 73 66 6f 72 6d 61 74 69 | 6f 6e 2e 0d 45 78 74 65 |sformati|on..Exte|
|00002600| 6e 64 69 6e 67 20 74 68 | 65 20 53 74 72 65 61 6d |nding th|e Stream|
|00002610| 73 20 63 6f 6d 70 6f 6e | 65 6e 74 0d 54 68 65 20 |s compon|ent.The |
|00002620| 73 74 72 65 61 6d 73 20 | 63 6f 6d 70 6f 6e 65 6e |streams |componen|
|00002630| 74 20 77 61 73 20 64 65 | 73 69 67 6e 65 64 20 74 |t was de|signed t|
|00002640| 6f 20 63 6f 6e 66 69 6e | 65 20 6d 6f 73 74 20 63 |o confin|e most c|
|00002650| 75 73 74 6f 6d 69 7a 61 | 74 69 6f 6e 73 20 61 6e |ustomiza|tions an|
|00002660| 64 20 65 78 74 65 6e 73 | 69 6f 6e 73 20 74 6f 20 |d extens|ions to |
|00002670| 61 20 73 75 62 63 6c 61 | 73 73 65 64 20 66 6f 72 |a subcla|ssed for|
|00002680| 6d 61 74 74 65 72 73 20 | 63 6c 61 73 73 2e 20 0d |matters |class. .|
|00002690| 43 72 65 61 74 65 20 61 | 20 46 57 5f 43 53 69 6e |Create a| FW_CSin|
|000026a0| 6b 20 73 75 62 63 6c 61 | 73 73 20 69 66 20 79 6f |k subcla|ss if yo|
|000026b0| 75 20 6e 65 65 64 20 74 | 6f 20 74 72 61 6e 73 66 |u need t|o transf|
|000026c0| 65 72 20 64 61 74 61 20 | 74 6f 20 6f 72 20 66 72 |er data |to or fr|
|000026d0| 6f 6d 20 61 20 73 65 72 | 69 61 6c 20 64 65 76 69 |om a ser|ial devi|
|000026e0| 63 65 20 74 68 61 74 20 | 4f 50 46 20 64 6f 65 73 |ce that |OPF does|
|000026f0| 6e d5 74 20 61 6c 72 65 | 61 64 79 20 73 75 70 70 |n.t alre|ady supp|
|00002700| 6f 72 74 2e 20 43 72 65 | 61 74 65 20 61 20 73 75 |ort. Cre|ate a su|
|00002710| 62 63 6c 61 73 73 20 6f | 66 20 74 68 65 20 46 57 |bclass o|f the FW|
|00002720| 5f 43 52 61 6e 64 6f 6d | 41 63 63 65 73 73 53 69 |_CRandom|AccessSi|
|00002730| 6e 6b 20 73 75 62 63 6c | 61 73 73 20 69 66 20 79 |nk subcl|ass if y|
|00002740| 6f 75 20 6e 65 65 64 20 | 74 6f 20 74 72 61 6e 73 |ou need |to trans|
|00002750| 66 65 72 20 64 61 74 61 | 20 74 6f 20 6f 72 20 66 |fer data| to or f|
|00002760| 72 6f 6d 20 61 20 72 61 | 6e 64 6f 6d 20 61 63 63 |rom a ra|ndom acc|
|00002770| 65 73 73 20 64 65 76 69 | 63 65 20 74 68 61 74 20 |ess devi|ce that |
|00002780| 4f 50 46 20 64 6f 65 73 | 6e d5 74 20 61 6c 72 65 |OPF does|n.t alre|
|00002790| 61 64 79 20 73 75 70 70 | 6f 72 74 2e 20 4f 50 46 |ady supp|ort. OPF|
|000027a0| 20 73 75 70 70 6f 72 74 | 73 20 6d 65 6d 6f 72 79 | support|s memory|
|000027b0| 2c 20 66 69 6c 65 2c 20 | 61 6e 64 20 72 65 73 6f |, file, |and reso|
|000027c0| 75 72 63 65 20 73 69 6e | 6b 73 2e 20 0d 46 57 5f |urce sin|ks. .FW_|
|000027d0| 43 52 65 61 64 61 62 6c | 65 53 74 72 65 61 6d 20 |CReadabl|eStream |
|000027e0| 61 6e 64 20 46 57 5f 43 | 57 72 69 74 61 62 6c 65 |and FW_C|Writable|
|000027f0| 53 74 72 65 61 6d 20 61 | 72 65 20 6e 6f 6e 2d 70 |Stream a|re non-p|
|00002800| 6f 6c 79 6d 6f 72 70 68 | 69 63 20 63 6c 61 73 73 |olymorph|ic class|
|00002810| 65 73 20 77 68 69 63 68 | 20 61 72 65 20 6e 6f 74 |es which| are not|
|00002820| 20 69 6e 74 65 6e 64 65 | 64 20 74 6f 20 62 65 20 | intende|d to be |
|00002830| 73 75 62 63 6c 61 73 73 | 65 64 2e 20 0d 43 61 74 |subclass|ed. .Cat|
|00002840| 63 68 69 6e 67 20 53 74 | 72 65 61 6d 73 20 63 6f |ching St|reams co|
|00002850| 6d 70 6f 6e 65 6e 74 20 | 65 78 63 65 70 74 69 6f |mponent |exceptio|
|00002860| 6e 73 0d 52 65 61 64 61 | 62 6c 65 20 61 6e 64 20 |ns.Reada|ble and |
|00002870| 77 72 69 74 61 62 6c 65 | 20 73 74 72 65 61 6d 73 |writable| streams|
|00002880| 20 6f 62 6a 65 63 74 73 | 20 64 6f 20 6e 6f 74 20 | objects| do not |
|00002890| 74 68 72 6f 77 20 6e 6f | 72 20 63 61 74 63 68 20 |throw no|r catch |
|000028a0| 65 78 63 65 70 74 69 6f | 6e 73 2e 20 53 69 6e 6b |exceptio|ns. Sink|
|000028b0| 20 61 6e 64 20 66 6f 72 | 6d 61 74 74 65 72 20 6f | and for|matter o|
|000028c0| 62 6a 65 63 74 73 20 64 | 6f 20 74 68 72 6f 77 20 |bjects d|o throw |
|000028d0| 65 78 63 65 70 74 69 6f | 6e 73 2e 20 57 68 65 6e |exceptio|ns. When|
|000028e0| 20 61 20 73 69 6e 6b 20 | 6f 72 20 73 74 72 65 61 | a sink |or strea|
|000028f0| 6d 20 66 6f 72 6d 61 74 | 74 65 72 20 6f 62 6a 65 |m format|ter obje|
|00002900| 63 74 20 74 68 72 6f 77 | 73 20 61 6e 20 65 78 63 |ct throw|s an exc|
|00002910| 65 70 74 69 6f 6e 2c 20 | 69 74 20 69 73 20 70 61 |eption, |it is pa|
|00002920| 73 73 65 64 20 74 68 72 | 6f 75 67 68 20 74 68 65 |ssed thr|ough the|
|00002930| 20 73 74 72 65 61 6d 20 | 74 6f 20 74 68 65 20 63 | stream |to the c|
|00002940| 6c 69 65 6e 74 20 6f 66 | 20 74 68 65 20 73 74 72 |lient of| the str|
|00002950| 65 61 6d 2e 20 49 74 20 | 69 73 20 74 68 65 20 72 |eam. It |is the r|
|00002960| 65 73 70 6f 6e 73 69 62 | 69 6c 69 74 79 20 6f 66 |esponsib|ility of|
|00002970| 20 74 68 65 20 73 74 72 | 65 61 6d 20 63 6c 69 65 | the str|eam clie|
|00002980| 6e 74 20 6f 72 20 28 6d | 6f 72 65 20 6c 69 6b 65 |nt or (m|ore like|
|00002990| 6c 79 29 20 61 20 68 69 | 67 68 65 72 20 65 6e 74 |ly) a hi|gher ent|
|000029a0| 69 74 79 20 69 6e 20 74 | 68 65 20 63 61 6c 6c 20 |ity in t|he call |
|000029b0| 63 68 61 69 6e 20 73 75 | 63 68 20 61 73 20 74 68 |chain su|ch as th|
|000029c0| 65 20 73 74 72 65 61 6d | 20 63 72 65 61 74 6f 72 |e stream| creator|
|000029d0| 20 74 6f 20 63 61 74 63 | 68 20 74 68 65 20 65 78 | to catc|h the ex|
|000029e0| 63 65 70 74 69 6f 6e 2e | 0d 4f 50 46 20 73 74 72 |ception.|.OPF str|
|000029f0| 65 61 6d 73 20 6d 61 69 | 6e 74 61 69 6e 20 6e 6f |eams mai|ntain no|
|00002a00| 20 65 72 72 6f 72 20 73 | 74 61 74 65 2e 20 54 68 | error s|tate. Th|
|00002a10| 69 73 20 69 73 20 75 6e | 6c 69 6b 65 20 74 68 65 |is is un|like the|
|00002a20| 20 43 2b 2b 20 49 4f 53 | 74 72 65 61 6d 73 20 6c | C++ IOS|treams l|
|00002a30| 69 62 72 61 72 79 2c 20 | 77 68 6f 73 65 20 73 74 |ibrary, |whose st|
|00002a40| 72 65 61 6d 73 20 6d 61 | 69 6e 74 61 69 6e 20 61 |reams ma|intain a|
|00002a50| 6e 20 65 72 72 6f 72 20 | 73 74 61 74 65 20 74 68 |n error |state th|
|00002a60| 61 74 20 74 68 65 20 63 | 6c 69 65 6e 74 20 71 75 |at the c|lient qu|
|00002a70| 65 72 69 65 73 2e 0d 4f | 50 46 20 73 74 72 65 61 |eries..O|PF strea|
|00002a80| 6d 73 20 61 73 73 75 6d | 65 20 74 68 61 74 20 65 |ms assum|e that e|
|00002a90| 72 72 6f 72 73 20 77 68 | 69 63 68 20 61 72 65 20 |rrors wh|ich are |
|00002aa0| 70 72 6f 67 72 61 6d 6d | 61 74 69 63 61 6c 6c 79 |programm|atically|
|00002ab0| 20 75 6e 61 76 6f 69 64 | 61 62 6c 65 20 63 61 75 | unavoid|able cau|
|00002ac0| 73 65 20 61 6e 20 65 78 | 63 65 70 74 69 6f 6e 20 |se an ex|ception |
|00002ad0| 74 6f 20 62 65 20 74 68 | 72 6f 77 6e 2e 20 45 72 |to be th|rown. Er|
|00002ae0| 72 6f 72 73 20 74 68 61 | 74 20 61 72 65 20 70 72 |rors tha|t are pr|
|00002af0| 6f 67 72 61 6d 6d 61 74 | 69 63 61 6c 6c 79 20 61 |ogrammat|ically a|
|00002b00| 76 6f 69 64 61 62 6c 65 | 20 72 61 69 73 65 20 61 |voidable| raise a|
|00002b10| 6e 20 61 73 73 65 72 74 | 20 66 6c 61 67 20 69 6e |n assert| flag in|
|00002b20| 20 74 68 65 20 4f 50 46 | 20 64 65 62 75 67 20 76 | the OPF| debug v|
|00002b30| 65 72 73 69 6f 6e 2e 0d | 53 74 72 65 61 6d 73 20 |ersion..|Streams |
|00002b40| 63 6f 6d 70 6f 6e 65 6e | 74 20 74 61 73 6b 73 0d |componen|t tasks.|
|00002b50| 54 68 69 73 20 73 65 63 | 74 69 6f 6e 20 70 72 6f |This sec|tion pro|
|00002b60| 76 69 64 65 73 20 64 65 | 74 61 69 6c 65 64 20 72 |vides de|tailed r|
|00002b70| 65 76 69 65 77 73 20 6f | 66 20 73 65 76 65 72 61 |eviews o|f severa|
|00002b80| 6c 20 63 6f 64 69 6e 67 | 20 74 61 73 6b 73 20 75 |l coding| tasks u|
|00002b90| 73 69 6e 67 20 53 74 72 | 65 61 6d 73 20 63 6f 6d |sing Str|eams com|
|00002ba0| 70 6f 6e 65 6e 74 20 63 | 6c 61 73 73 65 73 2e 20 |ponent c|lasses. |
|00002bb0| 57 72 69 74 69 6e 67 20 | 74 61 73 6b 73 20 61 6e |Writing |tasks an|
|00002bc0| 64 20 72 65 61 64 69 6e | 67 20 74 61 73 6b 73 20 |d readin|g tasks |
|00002bd0| 61 72 65 20 67 72 6f 75 | 70 65 64 20 74 6f 67 65 |are grou|ped toge|
|00002be0| 74 68 65 72 2e 0d 57 72 | 69 74 69 6e 67 20 64 61 |ther..Wr|iting da|
|00002bf0| 74 61 20 75 73 69 6e 67 | 20 61 20 77 72 69 74 61 |ta using| a writa|
|00002c00| 62 6c 65 20 73 74 72 65 | 61 6d 20 6f 62 6a 65 63 |ble stre|am objec|
|00002c10| 74 0d 54 6f 20 77 72 69 | 74 65 20 64 61 74 61 2c |t.To wri|te data,|
|00002c20| 20 69 6e 73 74 61 6e 74 | 69 61 74 65 20 74 68 65 | instant|iate the|
|00002c30| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 6f 62 6a 65 63 | followi|ng objec|
|00002c40| 74 73 3a 0d 09 31 2e 09 | 41 20 73 69 6e 6b 0d 09 |ts:..1..|A sink..|
|00002c50| 32 2e 09 41 20 77 72 69 | 74 61 62 6c 65 20 73 74 |2..A wri|table st|
|00002c60| 72 65 61 6d 20 66 6f 72 | 6d 61 74 74 65 72 20 28 |ream for|matter (|
|00002c70| 6f 70 74 69 6f 6e 61 6c | 29 0d 09 33 2e 09 41 20 |optional|)..3..A |
|00002c80| 77 72 69 74 61 62 6c 65 | 20 73 74 72 65 61 6d 0d |writable| stream.|
|00002c90| 50 61 73 73 20 74 68 65 | 20 73 69 6e 6b 20 61 6e |Pass the| sink an|
|00002ca0| 64 20 66 6f 72 6d 61 74 | 74 65 72 20 6f 62 6a 65 |d format|ter obje|
|00002cb0| 63 74 73 20 74 6f 20 74 | 68 65 20 46 57 5f 43 57 |cts to t|he FW_CW|
|00002cc0| 72 69 74 61 62 6c 65 53 | 74 72 65 61 6d 20 6f 62 |ritableS|tream ob|
|00002cd0| 6a 65 63 74 20 75 70 6f | 6e 20 69 6e 73 74 61 6e |ject upo|n instan|
|00002ce0| 74 69 61 74 69 6e 67 20 | 74 68 65 20 73 74 72 65 |tiating |the stre|
|00002cf0| 61 6d 73 20 6f 62 6a 65 | 63 74 2c 20 61 6e 64 20 |ams obje|ct, and |
|00002d00| 74 68 65 6e 20 75 73 65 | 20 6f 70 65 72 61 74 6f |then use| operato|
|00002d10| 72 20 3c 3c 20 74 6f 20 | 77 72 69 74 65 20 64 61 |r << to |write da|
|00002d20| 74 61 20 74 6f 20 74 68 | 65 20 73 74 72 65 61 6d |ta to th|e stream|
|00002d30| 2e 0d 6f 76 65 72 76 69 | 65 77 0d 59 6f 75 20 77 |..overvi|ew.You w|
|00002d40| 69 6c 6c 20 65 69 74 68 | 65 72 20 70 61 73 73 20 |ill eith|er pass |
|00002d50| 61 6e 20 65 78 69 73 74 | 69 6e 67 20 73 69 6e 6b |an exist|ing sink|
|00002d60| 2c 20 69 6e 73 74 61 6e | 74 69 61 74 65 20 61 20 |, instan|tiate a |
|00002d70| 4f 50 46 2d 70 72 6f 76 | 69 64 65 64 20 73 69 6e |OPF-prov|ided sin|
|00002d80| 6b 20 28 46 57 5f 43 46 | 69 6c 65 41 63 63 65 73 |k (FW_CF|ileAcces|
|00002d90| 73 2c 20 46 57 5f 43 4d | 65 6d 6f 72 79 53 69 6e |s, FW_CM|emorySin|
|00002da0| 6b 2c 20 46 57 5f 43 52 | 65 73 6f 75 72 63 65 53 |k, FW_CR|esourceS|
|00002db0| 69 6e 6b 29 2c 20 6f 72 | 20 69 6e 73 74 61 6e 74 |ink), or| instant|
|00002dc0| 69 61 74 65 20 79 6f 75 | 72 20 6f 77 6e 20 73 75 |iate you|r own su|
|00002dd0| 62 63 6c 61 73 73 20 6f | 66 20 73 69 6e 6b 2e 20 |bclass o|f sink. |
|00002de0| 53 75 62 63 6c 61 73 73 | 20 66 72 6f 6d 20 46 57 |Subclass| from FW|
|00002df0| 5f 43 53 69 6e 6b 20 74 | 6f 20 63 72 65 61 74 65 |_CSink t|o create|
|00002e00| 20 61 20 43 2b 2b 20 77 | 72 61 70 70 65 72 20 66 | a C++ w|rapper f|
|00002e10| 6f 72 20 61 20 64 65 76 | 69 63 65 20 6e 6f 74 20 |or a dev|ice not |
|00002e20| 61 6c 72 65 61 64 79 20 | 73 75 70 70 6f 72 74 65 |already |supporte|
|00002e30| 64 20 62 79 20 4f 50 46 | 2e 20 49 66 20 61 20 72 |d by OPF|. If a r|
|00002e40| 61 6e 64 6f 6d 20 61 63 | 63 65 73 73 20 64 65 76 |andom ac|cess dev|
|00002e50| 69 63 65 20 69 73 20 74 | 6f 20 62 65 20 73 75 70 |ice is t|o be sup|
|00002e60| 70 6f 72 74 65 64 2c 20 | 73 75 62 63 6c 61 73 73 |ported, |subclass|
|00002e70| 20 66 72 6f 6d 20 46 57 | 5f 43 52 61 6e 64 6f 6d | from FW|_CRandom|
|00002e80| 41 63 63 65 73 73 53 69 | 6e 6b 20 69 6e 73 74 65 |AccessSi|nk inste|
|00002e90| 61 64 20 6f 66 20 46 57 | 5f 43 53 69 6e 6b 2e 0d |ad of FW|_CSink..|
|00002ea0| 59 6f 75 20 77 69 6c 6c | 20 65 69 74 68 65 72 20 |You will| either |
|00002eb0| 70 61 73 73 20 61 20 77 | 72 69 74 61 62 6c 65 20 |pass a w|ritable |
|00002ec0| 73 74 72 65 61 6d 20 66 | 6f 72 6d 61 74 74 65 72 |stream f|ormatter|
|00002ed0| 2c 20 69 6e 73 74 61 6e | 74 69 61 74 65 20 79 6f |, instan|tiate yo|
|00002ee0| 75 72 20 6f 77 6e 20 73 | 75 62 63 6c 61 73 73 20 |ur own s|ubclass |
|00002ef0| 6f 66 20 46 57 5f 43 57 | 72 69 74 61 62 6c 65 53 |of FW_CW|ritableS|
|00002f00| 74 72 65 61 6d 46 6f 72 | 6d 61 74 74 65 72 2c 20 |treamFor|matter, |
|00002f10| 6f 72 20 6c 65 74 20 74 | 68 65 20 46 57 5f 43 57 |or let t|he FW_CW|
|00002f20| 72 69 74 61 62 6c 65 53 | 74 72 65 61 6d 20 63 6f |ritableS|tream co|
|00002f30| 6e 73 74 72 75 63 74 6f | 72 20 63 72 65 61 74 65 |nstructo|r create|
|00002f40| 20 61 20 64 65 66 61 75 | 6c 74 20 66 6f 72 6d 61 | a defau|lt forma|
|00002f50| 74 74 65 72 20 66 6f 72 | 20 79 6f 75 2e 20 0d 54 |tter for| you. .T|
|00002f60| 68 65 20 46 57 5f 43 57 | 72 69 74 61 62 6c 65 53 |he FW_CW|ritableS|
|00002f70| 74 72 65 61 6d 46 6f 72 | 6d 61 74 74 65 72 20 70 |treamFor|matter p|
|00002f80| 72 6f 76 69 64 65 73 20 | 6e 6f 20 66 6f 72 6d 61 |rovides |no forma|
|00002f90| 74 74 69 6e 67 2e 20 57 | 68 61 74 20 69 73 20 77 |tting. W|hat is w|
|00002fa0| 72 69 74 74 65 6e 20 74 | 6f 20 74 68 65 20 73 69 |ritten t|o the si|
|00002fb0| 6e 6b 20 69 73 20 6e 6f | 74 20 6d 6f 64 69 66 69 |nk is no|t modifi|
|00002fc0| 65 64 20 69 6e 20 61 6e | 79 20 77 61 79 2e 20 49 |ed in an|y way. I|
|00002fd0| 6e 20 6e 6f 72 6d 61 6c | 20 63 69 72 63 75 6d 73 |n normal| circums|
|00002fe0| 74 61 6e 63 65 73 2c 20 | 79 6f 75 20 73 68 6f 75 |tances, |you shou|
|00002ff0| 6c 64 20 75 73 65 20 74 | 68 65 20 64 65 66 61 75 |ld use t|he defau|
|00003000| 6c 74 20 66 6f 72 6d 61 | 74 74 65 72 2e 0d 54 6f |lt forma|tter..To|
|00003010| 20 63 72 65 61 74 65 20 | 61 20 77 72 69 74 61 62 | create |a writab|
|00003020| 6c 65 20 73 74 72 65 61 | 6d 2c 20 70 61 73 73 20 |le strea|m, pass |
|00003030| 69 74 20 61 20 73 69 6e | 6b 2e 20 4f 70 74 69 6f |it a sin|k. Optio|
|00003040| 6e 61 6c 6c 79 2c 20 70 | 61 73 73 20 69 74 20 61 |nally, p|ass it a|
|00003050| 20 77 72 69 74 61 62 6c | 65 20 73 74 72 65 61 6d | writabl|e stream|
|00003060| 20 66 6f 72 6d 61 74 74 | 65 72 2e 20 49 66 20 79 | formatt|er. If y|
|00003070| 6f 75 20 64 6f 20 6e 6f | 74 20 73 70 65 63 69 66 |ou do no|t specif|
|00003080| 79 20 61 20 77 72 69 74 | 61 62 6c 65 20 73 74 72 |y a writ|able str|
|00003090| 65 61 6d 20 66 6f 72 6d | 61 74 74 65 72 2c 20 74 |eam form|atter, t|
|000030a0| 68 65 20 77 72 69 74 61 | 62 6c 65 20 73 74 72 65 |he writa|ble stre|
|000030b0| 61 6d 20 77 69 6c 6c 20 | 63 72 65 61 74 65 20 61 |am will |create a|
|000030c0| 20 64 65 66 61 75 6c 74 | 20 69 6e 73 74 61 6e 63 | default| instanc|
|000030d0| 65 20 6f 66 20 46 57 5f | 43 57 72 69 74 61 62 6c |e of FW_|CWritabl|
|000030e0| 65 53 74 72 65 61 6d 46 | 6f 72 6d 61 74 74 65 72 |eStreamF|ormatter|
|000030f0| 20 66 6f 72 20 79 6f 75 | 2e 20 54 68 65 20 64 65 | for you|. The de|
|00003100| 66 61 75 6c 74 20 73 74 | 72 65 61 6d 20 66 6f 72 |fault st|ream for|
|00003110| 6d 61 74 74 65 72 20 64 | 6f 65 73 20 6e 6f 20 66 |matter d|oes no f|
|00003120| 6f 72 6d 61 74 74 69 6e | 67 2e 20 0d 54 6f 20 77 |ormattin|g. .To w|
|00003130| 72 69 74 65 20 64 61 74 | 61 2c 20 75 73 65 20 6f |rite dat|a, use o|
|00003140| 70 65 72 61 74 6f 72 20 | 3c 3c 2e 20 46 57 5f 43 |perator |<<. FW_C|
|00003150| 57 72 69 74 61 62 6c 65 | 53 74 72 65 61 6d 20 70 |Writable|Stream p|
|00003160| 72 6f 76 69 64 65 73 20 | 6f 76 65 72 6c 6f 61 64 |rovides |overload|
|00003170| 65 64 20 69 6e 73 74 61 | 6e 63 65 73 20 6f 66 20 |ed insta|nces of |
|00003180| 6f 70 65 72 61 74 6f 72 | 20 3c 3c 20 66 6f 72 20 |operator| << for |
|00003190| 74 68 65 20 62 75 69 6c | 74 2d 69 6e 20 74 79 70 |the buil|t-in typ|
|000031a0| 65 73 2e 20 55 73 65 72 | 2d 64 65 66 69 6e 65 64 |es. User|-defined|
|000031b0| 20 74 79 70 65 73 20 6d | 61 79 20 62 65 20 73 75 | types m|ay be su|
|000031c0| 70 70 6f 72 74 65 64 20 | 62 79 20 70 72 6f 76 69 |pported |by provi|
|000031d0| 64 69 6e 67 20 67 6c 6f | 62 61 6c 20 66 75 6e 63 |ding glo|bal func|
|000031e0| 74 69 6f 6e 73 20 6f 66 | 20 74 68 65 20 66 6f 72 |tions of| the for|
|000031f0| 6d 61 74 3a 0d 63 6f 6e | 73 74 20 46 57 5f 43 57 |mat:.con|st FW_CW|
|00003200| 72 69 74 61 62 6c 65 53 | 74 72 65 61 6d 26 20 6f |ritableS|tream& o|
|00003210| 70 65 72 61 74 6f 72 3c | 3c 0d 28 63 6f 6e 73 74 |perator<|<.(const|
|00003220| 20 46 57 5f 43 57 72 69 | 74 61 62 6c 65 53 74 72 | FW_CWri|tableStr|
|00003230| 65 61 6d 26 20 73 74 72 | 65 61 6d 2c 20 0d 63 6f |eam& str|eam, .co|
|00003240| 6e 73 74 20 55 73 65 72 | 44 65 66 69 6e 65 64 54 |nst User|DefinedT|
|00003250| 79 70 65 26 20 79 6f 75 | 72 73 29 3b 0d 54 68 69 |ype& you|rs);.Thi|
|00003260| 73 20 74 65 63 68 6e 69 | 71 75 65 20 61 6c 6c 6f |s techni|que allo|
|00003270| 77 73 20 79 6f 75 20 74 | 6f 20 6f 75 74 70 75 74 |ws you t|o output|
|00003280| 20 75 73 65 72 2d 64 65 | 66 69 6e 65 64 20 74 79 | user-de|fined ty|
|00003290| 70 65 73 20 77 69 74 68 | 6f 75 74 20 6d 6f 64 69 |pes with|out modi|
|000032a0| 66 79 69 6e 67 20 74 68 | 65 20 46 57 5f 43 57 72 |fying th|e FW_CWr|
|000032b0| 69 74 61 62 6c 65 53 74 | 72 65 61 6d 20 63 6c 61 |itableSt|ream cla|
|000032c0| 73 73 2e 20 54 68 69 73 | 20 74 65 63 68 6e 69 71 |ss. This| techniq|
|000032d0| 75 65 20 69 73 20 69 64 | 65 6e 74 69 63 61 6c 20 |ue is id|entical |
|000032e0| 74 6f 20 74 68 61 74 20 | 75 73 65 64 20 77 69 74 |to that |used wit|
|000032f0| 68 20 74 68 65 20 43 2b | 2b 20 49 4f 53 74 72 65 |h the C+|+ IOStre|
|00003300| 61 6d 73 20 6c 69 62 72 | 61 72 79 2e 0d 54 68 65 |ams libr|ary..The|
|00003310| 20 69 6e 74 65 72 66 61 | 63 65 20 46 57 5f 43 57 | interfa|ce FW_CW|
|00003320| 72 69 74 61 62 6c 65 53 | 74 72 65 61 6d 20 70 72 |ritableS|tream pr|
|00003330| 6f 76 69 64 65 73 20 6f | 74 68 65 72 20 6d 65 74 |ovides o|ther met|
|00003340| 68 6f 64 73 20 66 6f 72 | 20 77 72 69 74 69 6e 67 |hods for| writing|
|00003350| 20 64 61 74 61 20 61 70 | 61 72 74 20 66 72 6f 6d | data ap|art from|
|00003360| 20 74 68 65 20 69 6e 73 | 65 72 74 69 6f 6e 20 6f | the ins|ertion o|
|00003370| 70 65 72 61 74 6f 72 73 | 2e 0d 43 72 65 61 74 69 |perators|..Creati|
|00003380| 6e 67 20 61 20 77 72 69 | 74 61 62 6c 65 20 73 74 |ng a wri|table st|
|00003390| 72 65 61 6d 20 66 72 6f | 6d 20 61 20 73 69 6e 6b |ream fro|m a sink|
|000033a0| 20 74 68 61 74 20 72 65 | 70 72 65 73 65 6e 74 73 | that re|presents|
|000033b0| 20 61 20 62 75 66 66 65 | 72 20 69 6e 20 6d 65 6d | a buffe|r in mem|
|000033c0| 6f 72 79 2e 0d 54 68 69 | 73 20 65 78 61 6d 70 6c |ory..Thi|s exampl|
|000033d0| 65 20 63 72 65 61 74 65 | 73 20 61 20 62 75 66 66 |e create|s a buff|
|000033e0| 65 72 20 61 6e 64 20 69 | 6e 73 74 61 6e 74 69 61 |er and i|nstantia|
|000033f0| 74 65 73 20 61 20 6d 65 | 6d 6f 72 79 20 73 69 6e |tes a me|mory sin|
|00003400| 6b 2c 20 6d 79 53 69 6e | 6b 2c 20 66 72 6f 6d 20 |k, mySin|k, from |
|00003410| 74 68 65 20 6d 65 6d 6f | 72 79 20 62 75 66 66 65 |the memo|ry buffe|
|00003420| 72 20 6e 61 6d 65 64 20 | 62 75 66 66 65 72 2e 0d |r named |buffer..|
|00003430| 4e 65 78 74 2c 20 69 74 | 20 69 6e 73 74 61 6e 74 |Next, it| instant|
|00003440| 69 61 74 65 73 20 61 20 | 77 72 69 74 61 62 6c 65 |iates a |writable|
|00003450| 20 73 74 72 65 61 6d 2c | 20 6d 79 57 72 69 74 61 | stream,| myWrita|
|00003460| 62 6c 65 53 74 72 65 61 | 6d 2c 20 75 73 69 6e 67 |bleStrea|m, using|
|00003470| 20 74 68 65 20 73 69 6e | 6b 20 6d 79 53 69 6e 6b | the sin|k mySink|
|00003480| 2e 20 4e 6f 74 65 20 74 | 68 61 74 20 73 69 6e 63 |. Note t|hat sinc|
|00003490| 65 20 6e 6f 20 77 72 69 | 74 61 62 6c 65 20 73 74 |e no wri|table st|
|000034a0| 72 65 61 6d 20 66 6f 72 | 6d 61 74 74 65 72 20 69 |ream for|matter i|
|000034b0| 73 20 73 70 65 63 69 66 | 69 65 64 2c 20 4f 50 46 |s specif|ied, OPF|
|000034c0| 20 77 69 6c 6c 20 63 72 | 65 61 74 65 20 61 20 64 | will cr|eate a d|
|000034d0| 65 66 61 75 6c 74 20 69 | 6e 73 74 61 6e 63 65 20 |efault i|nstance |
|000034e0| 6f 66 20 46 57 5f 43 57 | 72 69 74 61 62 6c 65 2d |of FW_CW|ritable-|
|000034f0| 53 74 72 65 61 6d 46 6f | 72 6d 61 74 74 65 72 2e |StreamFo|rmatter.|
|00003500| 0d 46 69 6e 61 6c 6c 79 | 2c 20 69 74 20 77 72 69 |.Finally|, it wri|
|00003510| 74 65 73 20 74 68 65 20 | 76 61 6c 75 65 73 20 61 |tes the |values a|
|00003520| 20 61 6e 64 20 62 20 74 | 6f 20 74 68 65 20 77 72 | and b t|o the wr|
|00003530| 69 74 61 62 6c 65 20 73 | 74 72 65 61 6d 2e 0d 63 |itable s|tream..c|
|00003540| 68 61 72 20 62 75 66 66 | 65 72 5b 32 30 30 30 5d |har buff|er[2000]|
|00003550| 3b 0d 46 57 5f 43 4d 65 | 6d 6f 72 79 53 69 6e 6b |;.FW_CMe|morySink|
|00003560| 20 6d 79 53 69 6e 6b 28 | 62 75 66 66 65 72 2c 20 | mySink(|buffer, |
|00003570| 73 69 7a 65 6f 66 28 62 | 75 66 66 65 72 29 29 3b |sizeof(b|uffer));|
|00003580| 0d 46 57 5f 43 57 72 69 | 74 61 62 6c 65 53 74 72 |.FW_CWri|tableStr|
|00003590| 65 61 6d 20 6d 79 57 72 | 69 74 61 62 6c 65 53 74 |eam myWr|itableSt|
|000035a0| 72 65 61 6d 28 26 6d 79 | 53 69 6e 6b 29 3b 0d 69 |ream(&my|Sink);.i|
|000035b0| 6e 74 20 09 09 61 20 3d | 20 31 3b 0d 73 68 6f 72 |nt ..a =| 1;.shor|
|000035c0| 74 20 09 62 20 3d 20 32 | 3b 0d 6d 79 57 72 69 74 |t .b = 2|;.myWrit|
|000035d0| 61 62 6c 65 53 74 72 65 | 61 6d 20 3c 3c 20 61 20 |ableStre|am << a |
|000035e0| 3c 3c 20 62 3b 0d 57 72 | 69 74 69 6e 67 20 64 61 |<< b;.Wr|iting da|
|000035f0| 74 61 20 64 69 72 65 63 | 74 6c 79 20 74 6f 20 74 |ta direc|tly to t|
|00003600| 68 65 20 73 69 6e 6b 0d | 54 68 69 73 20 70 72 6f |he sink.|This pro|
|00003610| 63 65 64 75 72 65 20 77 | 72 69 74 65 73 20 64 61 |cedure w|rites da|
|00003620| 74 61 20 64 69 72 65 63 | 74 6c 79 20 74 6f 20 61 |ta direc|tly to a|
|00003630| 20 73 69 6e 6b 20 6f 62 | 6a 65 63 74 2e 0d 4f 50 | sink ob|ject..OP|
|00003640| 46 20 73 69 6e 6b 73 20 | 61 72 65 20 61 6c 77 61 |F sinks |are alwa|
|00003650| 79 73 20 72 65 61 64 2d | 77 72 69 74 65 20 6f 62 |ys read-|write ob|
|00003660| 6a 65 63 74 73 2e 20 49 | 66 20 79 6f 75 20 63 72 |jects. I|f you cr|
|00003670| 65 61 74 65 20 61 20 63 | 75 73 74 6f 6d 20 73 69 |eate a c|ustom si|
|00003680| 6e 6b 20 74 68 61 74 20 | 69 73 20 72 65 61 64 2d |nk that |is read-|
|00003690| 20 6f 72 20 77 72 69 74 | 65 2d 6f 6e 6c 79 3b 20 | or writ|e-only; |
|000036a0| 74 68 65 6e 20 79 6f 75 | 20 6d 75 73 74 20 63 72 |then you| must cr|
|000036b0| 65 61 74 65 20 61 20 6d | 65 63 68 61 6e 69 73 6d |eate a m|echanism|
|000036c0| 20 77 68 69 63 68 20 68 | 61 6e 64 6c 65 73 20 61 | which h|andles a|
|000036d0| 6e 20 61 74 74 65 6d 70 | 74 20 74 6f 20 75 73 65 |n attemp|t to use|
|000036e0| 20 74 68 61 74 20 73 69 | 6e 6b 20 69 6e 20 74 68 | that si|nk in th|
|000036f0| 65 20 6f 74 68 65 72 20 | 6d 6f 64 65 2e 20 66 6f |e other |mode. fo|
|00003700| 72 20 65 78 61 6d 70 6c | 65 3b 20 46 57 5f 43 52 |r exampl|e; FW_CR|
|00003710| 65 73 6f 75 72 63 65 53 | 69 6e 6b 20 69 73 20 61 |esourceS|ink is a|
|00003720| 20 72 65 61 64 2d 6f 6e | 6c 79 20 73 69 6e 6b 20 | read-on|ly sink |
|00003730| 61 6e 64 20 6d 75 73 74 | 20 62 65 20 75 73 65 64 |and must| be used|
|00003740| 20 77 69 74 68 20 61 20 | 6d 65 63 68 61 6e 69 73 | with a |mechanis|
|00003750| 6d 20 74 68 61 74 20 63 | 61 74 63 68 65 73 20 61 |m that c|atches a|
|00003760| 74 74 65 6d 70 74 73 20 | 74 6f 20 77 72 69 74 65 |ttempts |to write|
|00003770| 20 74 6f 20 69 74 2e 0d | 09 31 2e 09 49 6e 73 74 | to it..|.1..Inst|
|00003780| 61 6e 74 69 61 74 65 20 | 73 69 6e 6b 2c 20 66 6f |antiate |sink, fo|
|00003790| 72 6d 61 74 74 65 72 20 | 61 6e 64 20 77 72 69 74 |rmatter |and writ|
|000037a0| 61 62 6c 65 20 73 74 72 | 65 61 6d 73 20 6f 62 6a |able str|eams obj|
|000037b0| 65 63 74 73 2e 20 0d 0d | 57 68 65 6e 20 75 73 69 |ects. ..|When usi|
|000037c0| 6e 67 20 4f 50 46 20 53 | 74 72 65 61 6d 73 20 63 |ng OPF S|treams c|
|000037d0| 6c 61 73 73 65 73 2c 20 | 79 6f 75 20 6d 61 79 20 |lasses, |you may |
|000037e0| 6e 6f 74 20 75 73 65 20 | 74 68 65 20 65 6e 64 6c |not use |the endl|
|000037f0| 20 6d 61 6e 69 70 75 6c | 61 74 6f 72 20 74 6f 20 | manipul|ator to |
|00003800| 65 6e 64 20 74 68 65 20 | 73 74 72 65 61 6d 20 6f |end the |stream o|
|00003810| 72 20 66 6c 75 73 68 20 | 74 68 65 20 62 75 66 66 |r flush |the buff|
|00003820| 65 72 2e 20 54 68 65 20 | 4f 50 46 20 53 74 72 65 |er. The |OPF Stre|
|00003830| 61 6d 73 20 63 6f 6d 70 | 6f 6e 65 6e 74 20 64 6f |ams comp|onent do|
|00003840| 65 73 20 6e 6f 74 20 73 | 75 70 70 6f 72 74 20 43 |es not s|upport C|
|00003850| 2b 2b 20 6d 61 6e 69 70 | 75 6c 61 74 6f 72 73 2e |++ manip|ulators.|
|00003860| 0d 09 32 2e 09 52 65 70 | 6f 73 69 74 69 6f 6e 20 |..2..Rep|osition |
|00003870| 74 68 65 20 62 75 66 66 | 65 72 20 70 6f 69 6e 74 |the buff|er point|
|00003880| 65 72 20 69 66 20 6e 65 | 63 65 73 73 61 72 79 2c |er if ne|cessary,|
|00003890| 20 73 6f 20 79 6f 75 20 | 61 72 65 20 77 72 69 74 | so you |are writ|
|000038a0| 69 6e 67 20 69 6e 74 6f | 20 74 68 65 20 63 6f 72 |ing into| the cor|
|000038b0| 72 65 63 74 20 62 75 66 | 66 65 72 20 6c 6f 63 61 |rect buf|fer loca|
|000038c0| 74 69 6f 6e 2e 20 49 66 | 20 79 6f 75 20 64 6f 20 |tion. If| you do |
|000038d0| 6e 6f 74 20 72 65 70 6f | 73 69 74 69 6f 6e 20 74 |not repo|sition t|
|000038e0| 68 65 20 62 75 66 66 65 | 72 20 77 72 69 74 65 2d |he buffe|r write-|
|000038f0| 70 6f 69 6e 74 65 72 2c | 20 74 68 65 6e 20 79 6f |pointer,| then yo|
|00003900| 75 20 77 69 6c 6c 20 61 | 70 70 65 6e 64 20 64 61 |u will a|ppend da|
|00003910| 74 61 20 74 6f 20 74 68 | 65 20 63 75 72 72 65 6e |ta to th|e curren|
|00003920| 74 20 70 6f 73 69 74 69 | 6f 6e 20 6f 66 20 74 68 |t positi|on of th|
|00003930| 65 20 62 75 66 66 65 72 | 2e 20 0d 09 33 2e 09 55 |e buffer|. ..3..U|
|00003940| 73 65 20 77 72 69 74 65 | 2c 20 57 72 69 74 65 50 |se write|, WriteP|
|00003950| 65 65 6b 20 61 6e 64 20 | 57 72 69 74 65 50 65 65 |eek and |WritePee|
|00003960| 6b 41 64 76 61 6e 63 65 | 20 6d 65 74 68 6f 64 73 |kAdvance| methods|
|00003970| 20 74 6f 20 63 6f 70 79 | 20 64 61 74 61 20 64 69 | to copy| data di|
|00003980| 72 65 63 74 6c 79 20 74 | 6f 20 74 68 65 20 73 69 |rectly t|o the si|
|00003990| 6e 6b 2e 0d 52 65 61 64 | 69 6e 67 20 64 61 74 61 |nk..Read|ing data|
|000039a0| 20 66 72 6f 6d 20 61 20 | 72 65 61 64 61 62 6c 65 | from a |readable|
|000039b0| 20 73 74 72 65 61 6d 20 | 6f 62 6a 65 63 74 0d 54 | stream |object.T|
|000039c0| 6f 20 69 6e 73 74 61 6e | 74 69 61 74 65 20 61 20 |o instan|tiate a |
|000039d0| 72 65 61 64 61 62 6c 65 | 20 73 74 72 65 61 6d 20 |readable| stream |
|000039e0| 6f 62 6a 65 63 74 20 66 | 72 6f 6d 20 46 57 5f 43 |object f|rom FW_C|
|000039f0| 52 65 61 64 61 62 6c 65 | 2d 53 74 72 65 61 6d 2c |Readable|-Stream,|
|00003a00| 20 79 6f 75 20 6e 65 65 | 64 20 61 20 73 69 6e 6b | you nee|d a sink|
|00003a10| 20 6f 62 6a 65 63 74 2e | 20 4f 70 74 69 6f 6e 61 | object.| Optiona|
|00003a20| 6c 6c 79 2c 20 79 6f 75 | 20 61 6c 73 6f 20 6e 65 |lly, you| also ne|
|00003a30| 65 64 20 61 20 72 65 61 | 64 61 62 6c 65 20 73 74 |ed a rea|dable st|
|00003a40| 72 65 61 6d 20 66 6f 72 | 6d 61 74 74 65 72 20 6f |ream for|matter o|
|00003a50| 62 6a 65 63 74 2e 20 49 | 66 20 79 6f 75 20 64 6f |bject. I|f you do|
|00003a60| 20 6e 6f 74 20 73 70 65 | 63 69 66 79 20 61 20 72 | not spe|cify a r|
|00003a70| 65 61 64 61 62 6c 65 20 | 73 74 72 65 61 6d 20 66 |eadable |stream f|
|00003a80| 6f 72 6d 61 74 74 65 72 | 2c 20 74 68 65 20 72 65 |ormatter|, the re|
|00003a90| 61 64 61 62 6c 65 20 73 | 74 72 65 61 6d 20 77 69 |adable s|tream wi|
|00003aa0| 6c 6c 20 63 72 65 61 74 | 65 20 61 20 64 65 66 61 |ll creat|e a defa|
|00003ab0| 75 6c 74 20 69 6e 73 74 | 61 6e 63 65 20 6f 66 20 |ult inst|ance of |
|00003ac0| 46 57 5f 43 52 65 61 64 | 61 62 6c 65 53 74 72 65 |FW_CRead|ableStre|
|00003ad0| 61 6d 46 6f 72 6d 61 74 | 74 65 72 20 66 6f 72 20 |amFormat|ter for |
|00003ae0| 79 6f 75 2e 20 54 79 70 | 69 63 61 6c 6c 79 2c 20 |you. Typ|ically, |
|00003af0| 79 6f 75 20 77 69 6c 6c | 20 6e 6f 74 20 73 75 62 |you will| not sub|
|00003b00| 63 6c 61 73 73 20 46 57 | 5f 43 52 65 61 64 61 62 |class FW|_CReadab|
|00003b10| 6c 65 53 74 72 65 61 6d | 2e 0d 54 6f 20 72 65 61 |leStream|..To rea|
|00003b20| 64 20 64 61 74 61 2c 20 | 69 6e 73 74 61 6e 74 69 |d data, |instanti|
|00003b30| 61 74 65 20 74 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |ate the |followin|
|00003b40| 67 20 6f 62 6a 65 63 74 | 73 3a 0d 09 31 2e 09 41 |g object|s:..1..A|
|00003b50| 20 73 69 6e 6b 0d 09 32 | 2e 09 41 20 72 65 61 64 | sink..2|..A read|
|00003b60| 61 62 6c 65 20 73 74 72 | 65 61 6d 20 66 6f 72 6d |able str|eam form|
|00003b70| 61 74 74 65 72 0d 09 33 | 2e 09 41 20 72 65 61 64 |atter..3|..A read|
|00003b80| 61 62 6c 65 20 73 74 72 | 65 61 6d 0d 50 61 73 73 |able str|eam.Pass|
|00003b90| 20 74 68 65 20 73 69 6e | 6b 20 61 6e 64 20 66 6f | the sin|k and fo|
|00003ba0| 72 6d 61 74 74 65 72 20 | 6f 62 6a 65 63 74 73 20 |rmatter |objects |
|00003bb0| 74 6f 20 74 68 65 20 46 | 57 5f 43 52 65 61 64 61 |to the F|W_CReada|
|00003bc0| 62 6c 65 53 74 72 65 61 | 6d 20 6f 62 6a 65 63 74 |bleStrea|m object|
|00003bd0| 20 75 70 6f 6e 20 69 6e | 73 74 61 6e 74 69 61 74 | upon in|stantiat|
|00003be0| 69 6e 67 20 74 68 65 20 | 73 74 72 65 61 6d 73 20 |ing the |streams |
|00003bf0| 6f 62 6a 65 63 74 2c 20 | 61 6e 64 20 74 68 65 6e |object, |and then|
|00003c00| 20 75 73 65 20 6f 70 65 | 72 61 74 6f 72 20 3c 3c | use ope|rator <<|
|00003c10| 20 74 6f 20 77 72 69 74 | 65 20 64 61 74 61 20 74 | to writ|e data t|
|00003c20| 6f 20 74 68 65 20 73 74 | 72 65 61 6d 2e 0d 4f 76 |o the st|ream..Ov|
|00003c30| 65 72 76 69 65 77 0d 59 | 6f 75 20 77 69 6c 6c 20 |erview.Y|ou will |
|00003c40| 65 69 74 68 65 72 20 70 | 61 73 73 20 61 20 73 69 |either p|ass a si|
|00003c50| 6e 6b 2c 20 69 6e 73 74 | 61 6e 74 69 61 74 65 20 |nk, inst|antiate |
|00003c60| 61 20 4f 50 46 2d 70 72 | 6f 76 69 64 65 64 20 73 |a OPF-pr|ovided s|
|00003c70| 69 6e 6b 20 28 46 57 5f | 43 46 69 6c 65 41 63 63 |ink (FW_|CFileAcc|
|00003c80| 65 73 73 2c 20 46 57 5f | 43 4d 65 6d 6f 72 79 53 |ess, FW_|CMemoryS|
|00003c90| 69 6e 6b 2c 20 46 57 5f | 43 52 65 73 6f 75 72 63 |ink, FW_|CResourc|
|00003ca0| 65 53 69 6e 6b 29 2c 20 | 6f 72 20 69 6e 73 74 61 |eSink), |or insta|
|00003cb0| 6e 74 69 61 74 65 20 79 | 6f 75 72 20 6f 77 6e 20 |ntiate y|our own |
|00003cc0| 73 75 62 63 6c 61 73 73 | 20 6f 66 20 46 57 5f 43 |subclass| of FW_C|
|00003cd0| 53 69 6e 6b 2e 20 0d 53 | 75 62 63 6c 61 73 73 20 |Sink. .S|ubclass |
|00003ce0| 66 72 6f 6d 20 46 57 5f | 43 53 69 6e 6b 20 74 6f |from FW_|CSink to|
|00003cf0| 20 63 72 65 61 74 65 20 | 61 20 43 2b 2b 20 77 72 | create |a C++ wr|
|00003d00| 61 70 70 65 72 20 66 6f | 72 20 61 20 64 65 76 69 |apper fo|r a devi|
|00003d10| 63 65 20 6e 6f 74 20 61 | 6c 72 65 61 64 79 20 73 |ce not a|lready s|
|00003d20| 75 70 70 6f 72 74 65 64 | 20 62 79 20 4f 50 46 2e |upported| by OPF.|
|00003d30| 20 49 66 20 79 6f 75 20 | 6d 75 73 74 20 73 75 70 | If you |must sup|
|00003d40| 70 6f 72 74 20 61 20 72 | 61 6e 64 6f 6d 20 61 63 |port a r|andom ac|
|00003d50| 63 65 73 73 20 64 65 76 | 69 63 65 2c 20 73 75 62 |cess dev|ice, sub|
|00003d60| 63 6c 61 73 73 20 66 72 | 6f 6d 20 46 57 5f 43 52 |class fr|om FW_CR|
|00003d70| 61 6e 64 6f 6d 41 63 63 | 65 73 73 53 69 6e 6b 20 |andomAcc|essSink |
|00003d80| 69 6e 73 74 65 61 64 20 | 6f 66 20 46 57 5f 43 53 |instead |of FW_CS|
|00003d90| 69 6e 6b 2e 0d 59 6f 75 | 20 77 69 6c 6c 20 65 69 |ink..You| will ei|
|00003da0| 74 68 65 72 20 70 61 73 | 73 20 61 20 72 65 61 64 |ther pas|s a read|
|00003db0| 61 62 6c 65 20 73 74 72 | 65 61 6d 20 66 6f 72 6d |able str|eam form|
|00003dc0| 61 74 74 65 72 2c 20 69 | 6e 73 74 61 6e 74 69 61 |atter, i|nstantia|
|00003dd0| 74 65 20 79 6f 75 72 20 | 6f 77 6e 20 73 75 62 63 |te your |own subc|
|00003de0| 6c 61 73 73 20 6f 66 20 | 46 57 5f 43 52 65 61 64 |lass of |FW_CRead|
|00003df0| 61 62 6c 65 53 74 72 65 | 61 6d 46 6f 72 6d 61 74 |ableStre|amFormat|
|00003e00| 74 65 72 2c 20 6f 72 20 | 6c 65 74 20 74 68 65 20 |ter, or |let the |
|00003e10| 46 57 5f 43 52 65 61 64 | 61 62 6c 65 53 74 72 65 |FW_CRead|ableStre|
|00003e20| 61 6d 20 63 6f 6e 73 74 | 72 75 63 74 6f 72 20 63 |am const|ructor c|
|00003e30| 72 65 61 74 65 20 61 20 | 64 65 66 61 75 6c 74 20 |reate a |default |
|00003e40| 66 6f 72 6d 61 74 74 65 | 72 20 66 6f 72 20 79 6f |formatte|r for yo|
|00003e50| 75 2e 0d 54 6f 20 69 6e | 73 74 61 6e 74 69 61 74 |u..To in|stantiat|
|00003e60| 65 20 61 20 72 65 61 64 | 61 62 6c 65 20 73 74 72 |e a read|able str|
|00003e70| 65 61 6d 20 6f 62 6a 65 | 63 74 20 66 72 6f 6d 20 |eam obje|ct from |
|00003e80| 46 57 5f 43 52 65 61 64 | 61 62 6c 65 53 74 72 65 |FW_CRead|ableStre|
|00003e90| 61 6d 2c 20 70 61 73 73 | 20 69 74 20 61 20 73 69 |am, pass| it a si|
|00003ea0| 6e 6b 20 6f 62 6a 65 63 | 74 2e 20 4f 70 74 69 6f |nk objec|t. Optio|
|00003eb0| 6e 61 6c 6c 79 2c 20 70 | 61 73 73 20 69 74 20 61 |nally, p|ass it a|
|00003ec0| 20 72 65 61 64 61 62 6c | 65 20 73 74 72 65 61 6d | readabl|e stream|
|00003ed0| 20 66 6f 72 6d 61 74 74 | 65 72 20 6f 62 6a 65 63 | formatt|er objec|
|00003ee0| 74 2e 20 49 66 20 6e 6f | 20 72 65 61 64 61 62 6c |t. If no| readabl|
|00003ef0| 65 20 73 74 72 65 61 6d | 20 66 6f 72 6d 61 74 74 |e stream| formatt|
|00003f00| 65 72 20 69 73 20 73 70 | 65 63 69 66 69 65 64 2c |er is sp|ecified,|
|00003f10| 20 74 68 65 20 72 65 61 | 64 61 62 6c 65 20 73 74 | the rea|dable st|
|00003f20| 72 65 61 6d 20 77 69 6c | 6c 20 63 72 65 61 74 65 |ream wil|l create|
|00003f30| 20 61 20 64 65 66 61 75 | 6c 74 20 69 6e 73 74 61 | a defau|lt insta|
|00003f40| 6e 63 65 20 6f 66 20 46 | 57 5f 43 52 65 61 64 61 |nce of F|W_CReada|
|00003f50| 62 6c 65 53 74 72 65 61 | 6d 46 6f 72 6d 61 74 74 |bleStrea|mFormatt|
|00003f60| 65 72 20 66 6f 72 20 79 | 6f 75 2e 20 54 68 65 20 |er for y|ou. The |
|00003f70| 64 65 66 61 75 6c 74 20 | 73 74 72 65 61 6d 20 66 |default |stream f|
|00003f80| 6f 72 6d 61 74 74 65 72 | 20 64 6f 65 73 20 6e 6f |ormatter| does no|
|00003f90| 20 66 6f 72 6d 61 74 74 | 69 6e 67 2e 20 0d 54 6f | formatt|ing. .To|
|00003fa0| 20 72 65 61 64 20 64 61 | 74 61 2c 20 75 73 65 20 | read da|ta, use |
|00003fb0| 74 68 65 20 65 78 74 72 | 61 63 74 69 6f 6e 20 6f |the extr|action o|
|00003fc0| 70 65 72 61 74 6f 72 2c | 20 6f 70 65 72 61 74 6f |perator,| operato|
|00003fd0| 72 20 3e 3e 2e 20 46 57 | 5f 43 52 65 61 64 61 62 |r >>. FW|_CReadab|
|00003fe0| 6c 65 53 74 72 65 61 6d | 20 70 72 6f 76 69 64 65 |leStream| provide|
|00003ff0| 73 20 6f 76 65 72 6c 6f | 61 64 65 64 20 69 6e 73 |s overlo|aded ins|
|00004000| 74 61 6e 63 65 73 20 6f | 66 20 6f 70 65 72 61 74 |tances o|f operat|
|00004010| 6f 72 20 3e 3e 20 66 6f | 72 20 74 68 65 20 62 75 |or >> fo|r the bu|
|00004020| 69 6c 74 2d 69 6e 20 74 | 79 70 65 73 2e 20 59 6f |ilt-in t|ypes. Yo|
|00004030| 75 20 6d 61 79 20 73 75 | 70 70 6f 72 74 20 79 6f |u may su|pport yo|
|00004040| 75 72 20 6f 77 6e 20 64 | 61 74 61 20 74 79 70 65 |ur own d|ata type|
|00004050| 20 62 79 20 70 72 6f 76 | 69 64 69 6e 67 20 67 6c | by prov|iding gl|
|00004060| 6f 62 61 6c 20 66 75 6e | 63 74 69 6f 6e 73 20 6f |obal fun|ctions o|
|00004070| 66 20 74 68 65 20 66 6f | 72 6d 20 73 68 6f 77 6e |f the fo|rm shown|
|00004080| 20 62 65 6c 6f 77 2e 0d | 63 6f 6e 73 74 20 46 57 | below..|const FW|
|00004090| 5f 43 52 65 61 64 61 62 | 6c 65 53 74 72 65 61 6d |_CReadab|leStream|
|000040a0| 26 20 6f 70 65 72 61 74 | 6f 72 3e 3e 0d 28 63 6f |& operat|or>>.(co|
|000040b0| 6e 73 74 20 46 57 5f 43 | 52 65 61 64 61 62 6c 65 |nst FW_C|Readable|
|000040c0| 53 74 72 65 61 6d 26 20 | 73 74 72 65 61 6d 2c 20 |Stream& |stream, |
|000040d0| 55 73 65 72 44 65 66 69 | 6e 65 64 54 79 70 65 26 |UserDefi|nedType&|
|000040e0| 20 79 6f 75 72 73 29 3b | 0d 54 68 69 73 20 74 65 | yours);|.This te|
|000040f0| 63 68 6e 69 71 75 65 20 | 61 6c 6c 6f 77 73 20 79 |chnique |allows y|
|00004100| 6f 75 20 74 6f 20 6f 75 | 74 70 75 74 20 75 73 65 |ou to ou|tput use|
|00004110| 72 2d 64 65 66 69 6e 65 | 64 20 74 79 70 65 73 20 |r-define|d types |
|00004120| 77 69 74 68 6f 75 74 20 | 6d 6f 64 69 66 79 69 6e |without |modifyin|
|00004130| 67 20 74 68 65 20 46 57 | 5f 43 52 65 61 64 61 62 |g the FW|_CReadab|
|00004140| 6c 65 53 74 72 65 61 6d | 20 63 6c 61 73 73 2e 20 |leStream| class. |
|00004150| 54 68 69 73 20 74 65 63 | 68 6e 69 71 75 65 20 69 |This tec|hnique i|
|00004160| 73 20 69 64 65 6e 74 69 | 63 61 6c 20 74 6f 20 74 |s identi|cal to t|
|00004170| 68 65 20 74 65 63 68 6e | 69 71 75 65 20 75 73 65 |he techn|ique use|
|00004180| 64 20 69 6e 20 74 68 65 | 20 43 2b 2b 20 49 4f 53 |d in the| C++ IOS|
|00004190| 74 72 65 61 6d 73 20 6c | 69 62 72 61 72 79 2e 0d |treams l|ibrary..|
|000041a0| 52 65 61 64 69 6e 67 20 | 64 61 74 61 20 66 72 6f |Reading |data fro|
|000041b0| 6d 20 61 20 72 65 61 64 | 61 62 6c 65 20 73 74 72 |m a read|able str|
|000041c0| 65 61 6d 0d 54 68 69 73 | 20 65 78 61 6d 70 6c 65 |eam.This| example|
|000041d0| 20 72 65 61 64 73 20 74 | 68 65 20 64 61 74 61 20 | reads t|he data |
|000041e0| 77 72 69 74 74 65 6e 20 | 69 6e 20 74 68 65 20 57 |written |in the W|
|000041f0| 72 69 74 69 6e 67 20 64 | 61 74 61 20 74 6f 20 61 |riting d|ata to a|
|00004200| 20 77 72 69 74 61 62 6c | 65 20 73 74 72 65 61 6d | writabl|e stream|
|00004210| 20 65 78 61 6d 70 6c 65 | 2e 0d 46 6f 72 20 72 65 | example|..For re|
|00004220| 66 65 72 65 6e 63 65 2c | 20 68 65 72 65 20 69 73 |ference,| here is|
|00004230| 20 74 68 65 20 63 6f 64 | 65 20 74 68 61 74 20 77 | the cod|e that w|
|00004240| 72 6f 74 65 20 64 61 74 | 61 20 74 6f 20 74 68 65 |rote dat|a to the|
|00004250| 20 77 72 69 74 61 62 6c | 65 20 73 74 72 65 61 6d | writabl|e stream|
|00004260| 2e 0d 63 68 61 72 20 62 | 75 66 66 65 72 5b 32 30 |..char b|uffer[20|
|00004270| 30 30 5d 3b 0d 46 57 5f | 43 4d 65 6d 6f 72 79 53 |00];.FW_|CMemoryS|
|00004280| 69 6e 6b 20 6d 79 53 69 | 6e 6b 0d 28 62 75 66 66 |ink mySi|nk.(buff|
|00004290| 65 72 2c 20 73 69 7a 65 | 6f 66 28 62 75 66 66 65 |er, size|of(buffe|
|000042a0| 72 29 29 3b 0d 46 57 5f | 43 57 72 69 74 61 62 6c |r));.FW_|CWritabl|
|000042b0| 65 53 74 72 65 61 6d 20 | 6d 79 57 72 69 74 61 62 |eStream |myWritab|
|000042c0| 6c 65 53 74 72 65 61 6d | 28 26 6d 79 53 69 6e 6b |leStream|(&mySink|
|000042d0| 29 3b 0d 69 6e 74 09 09 | 61 20 3d 20 31 3b 0d 73 |);.int..|a = 1;.s|
|000042e0| 68 6f 72 74 09 09 62 20 | 3d 20 32 3b 0d 6d 79 57 |hort..b |= 2;.myW|
|000042f0| 72 69 74 61 62 6c 65 53 | 74 72 65 61 6d 20 3c 3c |ritableS|tream <<|
|00004300| 20 61 20 3c 3c 20 62 20 | 3b 0d 54 68 65 20 65 78 | a << b |;.The ex|
|00004310| 61 6d 70 6c 65 20 62 65 | 6c 6f 77 20 72 65 73 65 |ample be|low rese|
|00004320| 74 73 20 74 68 65 20 73 | 69 6e 6b 20 70 6f 73 69 |ts the s|ink posi|
|00004330| 74 69 6f 6e 20 70 6f 69 | 6e 74 65 72 20 74 6f 20 |tion poi|nter to |
|00004340| 74 68 65 20 73 74 61 72 | 74 2d 6f 66 2d 64 61 74 |the star|t-of-dat|
|00004350| 61 2e 20 54 68 65 6e 20 | 69 74 20 69 6e 73 74 61 |a. Then |it insta|
|00004360| 6e 74 69 61 74 65 73 20 | 61 20 72 65 61 64 61 62 |ntiates |a readab|
|00004370| 6c 65 20 73 74 72 65 61 | 6d 20 6f 62 6a 65 63 74 |le strea|m object|
|00004380| 20 6d 79 52 65 61 64 61 | 62 6c 65 2d 53 74 72 65 | myReada|ble-Stre|
|00004390| 61 6d 2c 20 61 6e 64 20 | 70 61 73 73 65 73 20 61 |am, and |passes a|
|000043a0| 20 72 65 66 65 72 65 6e | 63 65 20 74 6f 20 61 20 | referen|ce to a |
|000043b0| 73 69 6e 6b 20 6f 62 6a | 65 63 74 20 6d 79 53 69 |sink obj|ect mySi|
|000043c0| 6e 6b 20 74 6f 20 69 74 | 2e 20 49 74 20 64 65 63 |nk to it|. It dec|
|000043d0| 6c 61 72 65 73 20 74 77 | 6f 20 76 61 72 69 61 62 |lares tw|o variab|
|000043e0| 6c 65 73 20 63 6f 72 72 | 65 73 70 6f 6e 64 69 6e |les corr|espondin|
|000043f0| 67 20 74 6f 20 74 68 65 | 20 64 61 74 61 20 69 74 |g to the| data it|
|00004400| 20 65 78 70 65 63 74 73 | 20 74 6f 20 72 65 63 65 | expects| to rece|
|00004410| 69 76 65 2c 20 61 6e 64 | 20 74 68 65 6e 20 69 74 |ive, and| then it|
|00004420| 20 63 61 6c 6c 73 20 74 | 68 65 20 72 65 61 64 61 | calls t|he reada|
|00004430| 62 6c 65 20 73 74 72 65 | 61 6d 20 6f 62 6a 65 63 |ble stre|am objec|
|00004440| 74 20 74 6f 20 72 65 74 | 72 69 65 76 65 20 74 68 |t to ret|rieve th|
|00004450| 6f 73 65 20 74 77 6f 20 | 69 6e 74 73 20 66 72 6f |ose two |ints fro|
|00004460| 6d 20 74 68 65 20 73 69 | 6e 6b 20 6f 62 6a 65 63 |m the si|nk objec|
|00004470| 74 2c 20 6d 79 53 69 6e | 6b 2e 0d 6d 79 53 69 6e |t, mySin|k..mySin|
|00004480| 6b 2e 53 65 74 50 6f 73 | 69 74 69 6f 6e 28 30 4c |k.SetPos|ition(0L|
|00004490| 29 3b 0d 46 57 5f 43 52 | 65 61 64 61 62 6c 65 53 |);.FW_CR|eadableS|
|000044a0| 74 72 65 61 6d 20 6d 79 | 52 65 61 64 61 62 6c 65 |tream my|Readable|
|000044b0| 53 74 72 65 61 6d 28 26 | 6d 79 53 69 6e 6b 29 3b |Stream(&|mySink);|
|000044c0| 0d 69 6e 74 09 09 61 52 | 65 61 64 3b 0d 73 68 6f |.int..aR|ead;.sho|
|000044d0| 72 74 09 09 62 52 65 61 | 64 3b 0d 6d 79 52 65 61 |rt..bRea|d;.myRea|
|000044e0| 64 61 62 6c 65 53 74 72 | 65 61 6d 20 3e 3e 20 61 |dableStr|eam >> a|
|000044f0| 52 65 61 64 20 3e 3e 20 | 62 52 65 61 64 3b 0d 45 |Read >> |bRead;.E|
|00004500| 78 74 65 6e 64 69 6e 67 | 20 61 20 73 74 72 65 61 |xtending| a strea|
|00004510| 6d 20 74 6f 20 77 72 69 | 74 65 20 6f 62 6a 65 63 |m to wri|te objec|
|00004520| 74 73 20 6f 66 20 79 6f | 75 72 20 6f 77 6e 20 74 |ts of yo|ur own t|
|00004530| 79 70 65 0d 54 68 69 73 | 20 70 72 6f 63 65 64 75 |ype.This| procedu|
|00004540| 72 65 20 6f 76 65 72 6c | 6f 61 64 73 20 74 68 65 |re overl|oads the|
|00004550| 20 3c 3c 20 6f 70 65 72 | 61 74 6f 72 20 74 6f 20 | << oper|ator to |
|00004560| 68 61 6e 64 6c 65 20 6f | 62 6a 65 63 74 73 20 6f |handle o|bjects o|
|00004570| 66 20 79 6f 75 72 20 6f | 77 6e 20 75 73 65 72 2d |f your o|wn user-|
|00004580| 74 79 70 65 2e 20 49 74 | 20 75 73 65 73 20 74 68 |type. It| uses th|
|00004590| 69 73 20 63 6f 64 65 20 | 61 73 20 61 20 67 6c 6f |is code |as a glo|
|000045a0| 62 61 6c 20 66 72 69 65 | 6e 64 20 66 75 6e 63 74 |bal frie|nd funct|
|000045b0| 69 6f 6e 2e 0d 09 31 2e | 09 44 65 63 6c 61 72 65 |ion...1.|.Declare|
|000045c0| 20 61 20 73 74 72 75 63 | 74 20 6f 66 20 79 6f 75 | a struc|t of you|
|000045d0| 72 20 6f 77 6e 20 64 65 | 66 69 6e 65 64 20 74 79 |r own de|fined ty|
|000045e0| 70 65 20 4d 79 54 79 70 | 65 2e 20 59 6f 75 72 20 |pe MyTyp|e. Your |
|000045f0| 6e 65 77 20 67 6c 6f 62 | 61 6c 20 66 75 6e 63 74 |new glob|al funct|
|00004600| 69 6f 6e 20 77 69 6c 6c | 20 70 72 6f 63 65 73 73 |ion will| process|
|00004610| 20 4d 79 74 79 70 65 20 | 6f 62 6a 65 63 74 73 2e | Mytype |objects.|
|00004620| 20 0d 0d 54 68 65 20 73 | 74 72 75 63 74 20 69 6e | ..The s|truct in|
|00004630| 63 6c 75 64 65 73 20 61 | 20 4d 79 54 79 70 65 20 |cludes a| MyType |
|00004640| 63 6f 6e 73 74 72 75 63 | 74 6f 72 2c 20 77 68 69 |construc|tor, whi|
|00004650| 63 68 20 69 73 20 61 6e | 20 69 6e 6c 69 6e 65 20 |ch is an| inline |
|00004660| 66 75 6e 63 74 69 6f 6e | 2e 20 49 74 20 69 6e 69 |function|. It ini|
|00004670| 74 69 61 6c 69 7a 65 73 | 20 74 68 65 20 76 61 6c |tializes| the val|
|00004680| 75 65 73 20 74 68 61 74 | 20 77 69 6c 6c 20 62 65 |ues that| will be|
|00004690| 20 70 61 73 73 65 64 20 | 74 6f 20 69 6e 20 74 68 | passed |to in th|
|000046a0| 65 20 73 74 72 65 61 6d | 2e 20 54 68 65 20 6f 74 |e stream|. The ot|
|000046b0| 68 65 72 20 74 77 6f 20 | 6d 65 6d 62 65 72 73 20 |her two |members |
|000046c0| 61 72 65 20 69 6e 74 20 | 66 69 65 6c 64 73 20 77 |are int |fields w|
|000046d0| 68 69 63 68 20 73 74 6f | 72 65 20 74 68 65 20 69 |hich sto|re the i|
|000046e0| 6e 69 74 69 61 6c 69 7a | 65 64 20 76 61 72 69 61 |nitializ|ed varia|
|000046f0| 62 6c 65 73 2e 0d 0d 09 | 73 74 72 75 63 74 20 4d |bles....|struct M|
|00004700| 79 54 79 70 65 20 0d 09 | 09 7b 0d 09 09 4d 79 54 |yType ..|.{...MyT|
|00004710| 79 70 65 20 28 69 6e 74 | 20 69 2c 20 69 6e 74 20 |ype (int| i, int |
|00004720| 6a 29 20 7b 66 49 20 3d | 20 69 3b 20 66 4a 20 3d |j) {fI =| i; fJ =|
|00004730| 20 6a 3b 7d 0d 0d 09 09 | 69 6e 74 20 66 49 3b 0d | j;}....|int fI;.|
|00004740| 09 09 69 6e 74 20 66 4a | 3b 0d 0d 09 09 7d 3b 0d |..int fJ|;....};.|
|00004750| 09 32 2e 09 43 72 65 61 | 74 65 20 61 20 67 6c 6f |.2..Crea|te a glo|
|00004760| 62 61 6c 20 6d 65 74 68 | 6f 64 20 6f 70 65 72 61 |bal meth|od opera|
|00004770| 74 6f 72 20 3c 3c 20 6f | 66 20 74 68 65 20 66 6f |tor << o|f the fo|
|00004780| 72 6d 20 73 68 6f 77 6e | 20 62 65 6c 6f 77 2e 0d |rm shown| below..|
|00004790| 09 09 46 57 5f 43 57 72 | 69 74 61 62 6c 65 53 74 |..FW_CWr|itableSt|
|000047a0| 72 65 61 6d 26 20 6f 70 | 65 72 61 74 6f 72 3c 3c |ream& op|erator<<|
|000047b0| 0d 09 09 28 46 57 5f 43 | 57 72 69 74 61 62 6c 65 |...(FW_C|Writable|
|000047c0| 53 74 72 65 61 6d 26 20 | 6d 79 73 74 72 65 61 6d |Stream& |mystream|
|000047d0| 2c 20 0d 09 09 63 6f 6e | 73 74 20 4d 79 54 79 70 |, ...con|st MyTyp|
|000047e0| 65 26 20 6d 79 56 61 6c | 75 65 29 3b 0d 0d 59 6f |e& myVal|ue);..Yo|
|000047f0| 75 20 77 69 6c 6c 20 70 | 61 73 73 20 79 6f 75 72 |u will p|ass your|
|00004800| 20 73 74 72 65 61 6d 20 | 74 6f 67 65 74 68 65 72 | stream |together|
|00004810| 20 77 69 74 68 20 74 68 | 65 20 61 64 64 72 65 73 | with th|e addres|
|00004820| 73 20 6f 66 20 61 6e 20 | 69 6e 73 74 61 6e 63 65 |s of an |instance|
|00004830| 20 6f 66 20 79 6f 75 72 | 20 4d 79 54 79 70 65 20 | of your| MyType |
|00004840| 73 74 72 75 63 74 20 74 | 6f 20 74 68 69 73 20 66 |struct t|o this f|
|00004850| 75 6e 63 74 69 6f 6e 2e | 0d 09 33 2e 09 57 72 69 |unction.|..3..Wri|
|00004860| 74 65 20 63 6f 64 65 20 | 66 6f 72 20 74 68 69 73 |te code |for this|
|00004870| 20 66 75 6e 63 74 69 6f | 6e 2e 0d 09 7b 20 0d 09 | functio|n...{ ..|
|00004880| 09 72 65 74 75 72 6e 20 | 6d 79 73 74 72 65 61 6d |.return |mystream|
|00004890| 20 3c 3c 20 6d 79 56 61 | 6c 75 65 2e 66 49 20 3c | << myVa|lue.fI <|
|000048a0| 3c 20 09 6d 79 56 61 6c | 75 65 2e 66 4a 3b 0d 20 |< .myVal|ue.fJ;. |
|000048b0| 09 20 7d 0d 09 34 2e 09 | 47 69 76 65 6e 20 61 20 |. }..4..|Given a |
|000048c0| 77 72 69 74 61 62 6c 65 | 20 73 74 72 65 61 6d 20 |writable| stream |
|000048d0| 6f 62 6a 65 63 74 20 77 | 72 69 74 61 62 6c 65 53 |object w|ritableS|
|000048e0| 74 72 65 61 6d 2c 20 79 | 6f 75 20 63 61 6e 20 77 |tream, y|ou can w|
|000048f0| 72 69 74 65 20 61 6e 20 | 69 6e 73 74 61 6e 63 65 |rite an |instance|
|00004900| 20 6f 66 20 74 68 65 20 | 6f 62 6a 65 63 74 20 73 | of the |object s|
|00004910| 6f 6d 65 56 61 6c 75 65 | 20 61 6e 64 20 72 65 61 |omeValue| and rea|
|00004920| 64 20 69 74 20 62 61 63 | 6b 20 75 73 69 6e 67 20 |d it bac|k using |
|00004930| 74 68 65 20 63 6f 64 65 | 20 62 65 6c 6f 77 2e 0d |the code| below..|
|00004940| 09 09 4d 79 54 79 70 65 | 20 73 6f 6d 65 56 61 6c |..MyType| someVal|
|00004950| 75 65 28 31 2c 32 29 3b | 0d 09 09 77 72 69 74 61 |ue(1,2);|...writa|
|00004960| 62 6c 65 53 74 72 65 61 | 6d 20 3c 3c 20 73 6f 6d |bleStrea|m << som|
|00004970| 65 56 61 6c 75 65 3b 0d | 0d 46 57 5f 43 4d 65 6d |eValue;.|.FW_CMem|
|00004980| 6f 72 79 53 69 6e 6b 20 | 43 6c 61 73 73 0d 49 6e |orySink |Class.In|
|00004990| 74 72 6f 64 75 63 74 69 | 6f 6e 0d 41 6e 20 6f 62 |troducti|on.An ob|
|000049a0| 6a 65 63 74 20 6f 66 20 | 74 68 69 73 20 63 6c 61 |ject of |this cla|
|000049b0| 73 73 20 63 6f 6e 73 74 | 72 75 63 74 73 20 61 20 |ss const|ructs a |
|000049c0| 72 61 6e 64 6f 6d 20 61 | 63 63 65 73 73 20 73 69 |random a|ccess si|
|000049d0| 6e 6b 20 66 72 6f 6d 20 | 61 20 6d 65 6d 6f 72 79 |nk from |a memory|
|000049e0| 20 62 75 66 66 65 72 2e | 0d 46 57 5f 43 4d 65 6d | buffer.|.FW_CMem|
|000049f0| 6f 72 79 53 69 6e 6b 20 | 69 73 20 61 20 63 6f 6e |orySink |is a con|
|00004a00| 63 72 65 74 65 20 63 6c | 61 73 73 20 64 65 72 69 |crete cl|ass deri|
|00004a10| 76 65 64 20 66 72 6f 6d | 20 46 57 5f 43 52 61 6e |ved from| FW_CRan|
|00004a20| 64 6f 6d 2d 41 63 63 65 | 73 73 53 69 6e 6b 2e 20 |dom-Acce|ssSink. |
|00004a30| 0d 48 65 61 64 65 72 20 | 46 69 6c 65 0d 46 57 41 |.Header |File.FWA|
|00004a40| 53 69 6e 6b 73 2e 68 0d | 48 65 72 69 74 61 67 65 |Sinks.h.|Heritage|
|00004a50| 0d 46 57 5f 43 53 69 6e | 6b 09 33 39 0d a5 46 57 |.FW_CSin|k.39..FW|
|00004a60| 5f 43 52 61 6e 64 6f 6d | 41 63 63 65 73 73 53 69 |_CRandom|AccessSi|
|00004a70| 6e 6b 09 32 31 0d a5 a5 | 46 57 5f 43 4d 65 6d 6f |nk.21...|FW_CMemo|
|00004a80| 72 79 53 69 6e 6b 0d a5 | a5 46 57 5f 43 46 69 6c |rySink..|.FW_CFil|
|00004a90| 65 41 63 63 65 73 73 09 | 78 78 0d a5 a5 a5 46 57 |eAccess.|xx....FW|
|00004aa0| 5f 43 52 65 73 6f 75 72 | 63 65 53 69 6e 6b 09 78 |_CResour|ceSink.x|
|00004ab0| 78 0d 55 73 69 6e 67 20 | 54 68 69 73 20 43 6c 61 |x.Using |This Cla|
|00004ac0| 73 73 0d 49 6e 73 74 61 | 6e 74 69 61 74 65 20 46 |ss.Insta|ntiate F|
|00004ad0| 57 5f 43 4d 65 6d 6f 72 | 79 53 69 6e 6b 20 6f 62 |W_CMemor|ySink ob|
|00004ae0| 6a 65 63 74 73 20 61 6e | 64 20 72 65 61 64 20 61 |jects an|d read a|
|00004af0| 6e 64 20 77 72 69 74 65 | 20 64 61 74 61 20 74 6f |nd write| data to|
|00004b00| 20 74 68 65 6d 20 61 73 | 20 64 65 73 63 72 69 62 | them as| describ|
|00004b10| 65 64 20 62 65 6c 6f 77 | 2e 0d 57 72 69 74 69 6e |ed below|..Writin|
|00004b20| 67 20 74 6f 20 61 20 46 | 57 5f 43 4d 65 6d 6f 72 |g to a F|W_CMemor|
|00004b30| 79 53 69 6e 6b 2e 0d 44 | 65 63 6c 61 72 65 20 61 |ySink..D|eclare a|
|00004b40| 6e 20 69 6e 73 74 61 6e | 63 65 20 6f 66 20 46 57 |n instan|ce of FW|
|00004b50| 5f 43 4d 65 6d 6f 72 79 | 53 69 6e 6b 20 61 6e 64 |_CMemory|Sink and|
|00004b60| 20 70 61 73 73 20 61 20 | 70 6f 69 6e 74 65 72 20 | pass a |pointer |
|00004b70| 74 6f 20 61 20 62 75 66 | 66 65 72 20 61 6e 64 20 |to a buf|fer and |
|00004b80| 74 68 65 20 73 69 7a 65 | 20 6f 66 20 74 68 65 20 |the size| of the |
|00004b90| 62 75 66 66 65 72 2e 20 | 4f 70 74 69 6f 6e 61 6c |buffer. |Optional|
|00004ba0| 6c 79 2c 20 73 70 65 63 | 69 66 79 20 74 68 65 20 |ly, spec|ify the |
|00004bb0| 69 6e 69 74 69 61 6c 20 | 70 6f 73 69 74 69 6f 6e |initial |position|
|00004bc0| 20 6f 66 20 74 68 65 20 | 73 69 6e 6b 2e 20 4e 6f | of the |sink. No|
|00004bd0| 72 6d 61 6c 6c 79 20 79 | 6f 75 20 73 68 6f 75 6c |rmally y|ou shoul|
|00004be0| 64 20 73 65 74 20 69 6e | 69 74 69 61 6c 50 6f 73 |d set in|itialPos|
|00004bf0| 69 74 69 6f 6e 20 74 6f | 20 30 2e 20 50 61 73 73 |ition to| 0. Pass|
|00004c00| 20 74 68 65 20 73 69 6e | 6b 20 6f 62 6a 65 63 74 | the sin|k object|
|00004c10| 20 74 6f 20 74 68 65 20 | 77 72 69 74 61 62 6c 65 | to the |writable|
|00004c20| 20 73 74 72 65 61 6d 20 | 6f 62 6a 65 63 74 2e 0d | stream |object..|
|00004c30| 50 61 73 73 20 79 6f 75 | 72 20 73 69 6e 6b 20 74 |Pass you|r sink t|
|00004c40| 6f 20 61 20 73 74 72 65 | 61 6d 73 20 6f 62 6a 65 |o a stre|ams obje|
|00004c50| 63 74 2e 20 55 73 65 20 | 74 68 65 20 73 74 72 65 |ct. Use |the stre|
|00004c60| 61 6d 73 20 6f 62 6a 65 | 63 74 20 74 6f 20 74 72 |ams obje|ct to tr|
|00004c70| 61 6e 73 66 65 72 20 64 | 61 74 61 20 62 65 74 77 |ansfer d|ata betw|
|00004c80| 65 65 6e 20 74 68 65 20 | 73 69 6e 6b 20 6f 62 6a |een the |sink obj|
|00004c90| 65 63 74 20 61 6e 64 20 | 79 6f 75 72 20 70 72 6f |ect and |your pro|
|00004ca0| 67 72 61 6d 2e 20 0d 4e | 6f 74 65 0d 59 6f 75 20 |gram. .N|ote.You |
|00004cb0| 63 61 6e 20 73 65 74 20 | 69 6e 69 74 69 61 6c 50 |can set |initialP|
|00004cc0| 6f 73 69 74 69 6f 6e 20 | 74 6f 20 61 20 76 61 6c |osition |to a val|
|00004cd0| 75 65 20 67 72 65 61 74 | 65 72 20 74 68 61 6e 20 |ue great|er than |
|00004ce0| 30 20 69 66 20 79 6f 75 | 20 77 61 6e 74 20 74 6f |0 if you| want to|
|00004cf0| 20 61 70 70 65 6e 64 20 | 6f 6e 74 6f 20 65 78 69 | append |onto exi|
|00004d00| 73 74 69 6e 67 20 64 61 | 74 61 20 69 6e 20 74 68 |sting da|ta in th|
|00004d10| 65 20 62 75 66 66 65 72 | 2e 20 0d 0d 52 65 61 64 |e buffer|. ..Read|
|00004d20| 69 6e 67 20 46 72 6f 6d | 20 61 20 53 69 6e 6b 0d |ing From| a Sink.|
|00004d30| 49 6e 73 74 61 6e 74 69 | 61 74 65 20 61 6e 20 6f |Instanti|ate an o|
|00004d40| 62 6a 65 63 74 20 6f 66 | 20 74 68 69 73 20 63 6c |bject of| this cl|
|00004d50| 61 73 73 20 61 6e 64 20 | 61 6e 20 6f 62 6a 65 63 |ass and |an objec|
|00004d60| 74 20 6f 66 20 74 68 65 | 20 46 57 5f 43 52 65 61 |t of the| FW_CRea|
|00004d70| 64 61 62 6c 65 53 74 72 | 65 61 6d 20 63 6c 61 73 |dableStr|eam clas|
|00004d80| 73 2e 20 0d 50 61 73 73 | 20 61 20 62 75 66 66 65 |s. .Pass| a buffe|
|00004d90| 72 20 73 69 7a 65 20 76 | 61 6c 75 65 20 74 6f 20 |r size v|alue to |
|00004da0| 74 68 65 20 46 57 5f 43 | 4d 65 6d 6f 72 79 53 69 |the FW_C|MemorySi|
|00004db0| 6e 6b 20 6f 62 6a 65 63 | 74 20 75 70 6f 6e 20 69 |nk objec|t upon i|
|00004dc0| 6e 73 74 61 6e 74 69 61 | 74 69 6f 6e 2c 20 61 6e |nstantia|tion, an|
|00004dd0| 64 20 73 65 74 20 69 6e | 69 74 69 61 6c 50 6f 73 |d set in|itialPos|
|00004de0| 69 74 69 6f 6e 20 74 6f | 20 30 2e 20 50 61 73 73 |ition to| 0. Pass|
|00004df0| 20 74 68 65 20 73 69 6e | 6b 20 6f 62 6a 65 63 74 | the sin|k object|
|00004e00| 20 74 6f 20 74 68 65 20 | 72 65 61 64 61 62 6c 65 | to the |readable|
|00004e10| 20 73 74 72 65 61 6d 20 | 6f 62 6a 65 63 74 2e 20 | stream |object. |
|00004e20| 54 68 65 20 62 75 66 66 | 65 72 20 63 61 70 61 63 |The buff|er capac|
|00004e30| 69 74 79 20 66 6f 72 20 | 79 6f 75 72 20 6d 65 6d |ity for |your mem|
|00004e40| 6f 72 79 20 73 69 6e 6b | 20 73 68 6f 75 6c 64 20 |ory sink| should |
|00004e50| 62 65 20 73 65 74 20 74 | 6f 20 74 68 65 20 74 6f |be set t|o the to|
|00004e60| 74 61 6c 20 73 69 7a 65 | 20 6f 66 20 74 68 65 20 |tal size| of the |
|00004e70| 62 75 66 66 65 72 2c 20 | 61 6e 64 20 77 69 6c 6c |buffer, |and will|
|00004e80| 20 62 65 20 75 73 65 64 | 20 74 6f 20 6c 69 6d 69 | be used| to limi|
|00004e90| 74 20 74 68 65 20 61 6d | 6f 75 6e 74 20 6f 66 20 |t the am|ount of |
|00004ea0| 64 61 74 61 20 74 68 61 | 74 20 63 61 6e 20 62 65 |data tha|t can be|
|00004eb0| 20 72 65 61 64 20 66 72 | 6f 6d 20 74 68 65 20 73 | read fr|om the s|
|00004ec0| 69 6e 6b 2e 20 0d 55 73 | 65 20 74 68 65 20 73 74 |ink. .Us|e the st|
|00004ed0| 72 65 61 6d 20 6f 62 6a | 65 63 74 20 74 6f 20 74 |ream obj|ect to t|
|00004ee0| 72 61 6e 73 66 65 72 20 | 64 61 74 61 20 62 65 74 |ransfer |data bet|
|00004ef0| 77 65 65 6e 20 74 68 65 | 20 73 69 6e 6b 20 6f 62 |ween the| sink ob|
|00004f00| 6a 65 63 74 20 61 6e 64 | 20 79 6f 75 72 20 70 72 |ject and| your pr|
|00004f10| 6f 67 72 61 6d 2e 20 0d | 52 65 6c 61 74 65 64 20 |ogram. .|Related |
|00004f20| 43 6c 61 73 73 65 73 0d | 55 73 65 20 61 20 46 57 |Classes.|Use a FW|
|00004f30| 5f 43 4d 65 6d 6f 72 79 | 53 69 6e 6b 20 6f 62 6a |_CMemory|Sink obj|
|00004f40| 65 63 74 20 62 79 20 69 | 74 73 65 6c 66 20 6f 72 |ect by i|tself or|
|00004f50| 20 61 73 20 74 68 65 20 | 73 69 6e 6b 20 66 6f 72 | as the |sink for|
|00004f60| 20 61 20 72 65 61 64 61 | 62 6c 65 20 6f 72 20 77 | a reada|ble or w|
|00004f70| 72 69 74 61 62 6c 65 20 | 73 74 72 65 61 6d 2e 20 |ritable |stream. |
|00004f80| 53 65 65 20 74 68 65 20 | 53 74 72 65 61 6d 73 20 |See the |Streams |
|00004f90| 63 6f 6d 70 6f 6e 65 6e | 74 20 66 6f 72 20 64 65 |componen|t for de|
|00004fa0| 74 61 69 6c 73 2e 0d 53 | 75 62 63 6c 61 73 73 69 |tails..S|ubclassi|
|00004fb0| 6e 67 20 46 57 5f 43 4d | 65 6d 6f 72 79 53 69 6e |ng FW_CM|emorySin|
|00004fc0| 6b 0d 46 57 5f 43 4d 65 | 6d 6f 72 79 53 69 6e 6b |k.FW_CMe|morySink|
|00004fd0| 20 69 73 20 61 20 63 6f | 6e 63 72 65 74 65 20 73 | is a co|ncrete s|
|00004fe0| 75 62 63 6c 61 73 73 20 | 6f 66 20 46 57 5f 43 53 |ubclass |of FW_CS|
|00004ff0| 69 6e 6b 20 61 6e 64 20 | 69 73 20 6e 6f 74 20 6e |ink and |is not n|
|00005000| 6f 72 6d 61 6c 6c 79 20 | 73 75 62 63 6c 61 73 73 |ormally |subclass|
|00005010| 65 64 2e 0d 49 6e 73 74 | 61 6e 74 69 61 74 69 6e |ed..Inst|antiatin|
|00005020| 67 20 74 68 69 73 20 63 | 6c 61 73 73 0d 49 6e 73 |g this c|lass.Ins|
|00005030| 74 61 6e 74 69 61 74 65 | 20 61 20 46 57 5f 43 4d |tantiate| a FW_CM|
|00005040| 65 6d 6f 72 79 53 69 6e | 6b 20 6f 62 6a 65 63 74 |emorySin|k object|
|00005050| 20 69 6e 20 6f 72 64 65 | 72 20 74 6f 20 75 73 65 | in orde|r to use|
|00005060| 20 61 6e 20 69 6e 2d 6d | 65 6d 6f 72 79 20 62 75 | an in-m|emory bu|
|00005070| 66 66 65 72 20 61 73 20 | 74 68 65 20 73 6f 75 72 |ffer as |the sour|
|00005080| 63 65 20 6f 72 20 64 65 | 73 74 69 6e 61 74 69 6f |ce or de|stinatio|
|00005090| 6e 20 6f 66 20 61 20 73 | 74 72 65 61 6d 2e 0d 46 |n of a s|tream..F|
|000050a0| 57 5f 43 4d 65 6d 6f 72 | 79 53 69 6e 6b 20 4d 65 |W_CMemor|ySink Me|
|000050b0| 74 68 6f 64 73 0d 0d 46 | 57 5f 43 4d 65 6d 6f 72 |thods..F|W_CMemor|
|000050c0| 79 53 69 6e 6b 28 76 6f | 69 64 2a 20 62 75 66 66 |ySink(vo|id* buff|
|000050d0| 65 72 2c 20 6c 6f 6e 67 | 20 63 61 70 61 63 69 74 |er, long| capacit|
|000050e0| 79 2c 20 0d 09 09 09 09 | 09 6c 6f 6e 67 20 69 6e |y, .....|.long in|
|000050f0| 69 74 69 61 6c 50 6f 73 | 69 74 69 6f 6e 3d 30 29 |itialPos|ition=0)|
|00005100| 3b 0d 0d 44 65 66 61 75 | 6c 74 20 63 6f 6e 73 74 |;..Defau|lt const|
|00005110| 72 75 63 74 6f 72 20 62 | 75 69 6c 64 73 20 61 20 |ructor b|uilds a |
|00005120| 62 75 66 66 65 72 20 61 | 6e 64 20 73 65 74 73 20 |buffer a|nd sets |
|00005130| 74 68 65 20 69 6e 69 74 | 69 61 6c 20 70 6f 73 69 |the init|ial posi|
|00005140| 74 69 6f 6e 20 6d 61 72 | 6b 65 72 20 77 69 74 68 |tion mar|ker with|
|00005150| 69 6e 20 74 68 65 20 62 | 75 66 66 65 72 2e 20 54 |in the b|uffer. T|
|00005160| 68 69 73 20 63 6f 6e 73 | 74 72 75 63 74 6f 72 20 |his cons|tructor |
|00005170| 66 69 72 65 73 20 61 6e | 20 61 73 73 65 72 74 20 |fires an| assert |
|00005180| 69 66 20 74 68 65 20 69 | 6e 69 74 69 61 6c 20 70 |if the i|nitial p|
|00005190| 6f 73 69 74 69 6f 6e 20 | 77 61 73 20 73 65 74 20 |osition |was set |
|000051a0| 74 6f 20 61 20 76 61 6c | 75 65 20 67 72 65 61 74 |to a val|ue great|
|000051b0| 65 72 20 74 68 61 6e 20 | 74 68 65 20 62 75 66 66 |er than |the buff|
|000051c0| 65 72 20 63 61 70 61 63 | 69 74 79 2e 0d 54 68 65 |er capac|ity..The|
|000051d0| 20 73 69 6e 6b 27 73 20 | 64 61 74 61 20 69 73 20 | sink's |data is |
|000051e0| 73 65 74 20 74 6f 20 74 | 68 65 20 62 75 66 66 65 |set to t|he buffe|
|000051f0| 72 20 6f 66 20 73 69 7a | 65 20 63 61 70 61 63 69 |r of siz|e capaci|
|00005200| 74 79 2e 20 54 68 65 20 | 73 69 6e 6b 73 20 69 6e |ty. The |sinks in|
|00005210| 69 74 69 61 6c 20 70 6f | 73 69 74 69 6f 6e 20 69 |itial po|sition i|
|00005220| 73 20 73 65 74 20 74 6f | 20 69 6e 69 74 69 61 6c |s set to| initial|
|00005230| 50 6f 73 69 74 69 6f 6e | 20 77 68 69 63 68 20 69 |Position| which i|
|00005240| 66 20 6e 6f 74 20 73 70 | 65 63 69 66 69 65 64 20 |f not sp|ecified |
|00005250| 69 73 20 30 2c 20 74 68 | 65 20 66 69 72 73 74 20 |is 0, th|e first |
|00005260| 62 79 74 65 20 6f 66 20 | 62 75 66 66 65 72 2e 0d |byte of |buffer..|
|00005270| 62 75 66 66 65 72 20 2d | 20 54 68 65 20 70 6f 69 |buffer -| The poi|
|00005280| 6e 74 65 72 20 74 6f 20 | 62 75 66 66 65 72 20 74 |nter to |buffer t|
|00005290| 6f 20 75 73 65 20 61 73 | 20 73 6f 75 72 63 65 20 |o use as| source |
|000052a0| 61 6e 64 2f 6f 72 20 64 | 65 73 74 69 6e 61 74 69 |and/or d|estinati|
|000052b0| 6f 6e 20 6f 66 20 73 69 | 6e 6b 20 64 61 74 61 2e |on of si|nk data.|
|000052c0| 0d 63 61 70 61 63 69 74 | 79 20 2d 20 54 68 65 20 |.capacit|y - The |
|000052d0| 73 69 7a 65 20 6f 66 20 | 62 75 66 66 65 72 2e 0d |size of |buffer..|
|000052e0| 69 6e 69 74 69 61 6c 50 | 6f 73 69 74 69 6f 6e 20 |initialP|osition |
|000052f0| 2d 20 54 68 65 20 69 6e | 69 74 69 61 6c 20 70 6f |- The in|itial po|
|00005300| 73 69 74 69 6f 6e 20 6f | 66 20 73 69 6e 6b 2e 0d |sition o|f sink..|
|00005310| 0d 0d 7e 46 57 5f 43 4d | 65 6d 6f 72 79 53 69 6e |..~FW_CM|emorySin|
|00005320| 6b 28 29 3b 0d 0d 43 6c | 61 73 73 20 64 65 73 74 |k();..Cl|ass dest|
|00005330| 72 75 63 74 6f 72 2e 0d | 0d 76 69 72 74 75 61 6c |ructor..|.virtual|
|00005340| 20 6c 6f 6e 67 20 47 65 | 74 57 72 69 74 61 62 6c | long Ge|tWritabl|
|00005350| 65 42 79 74 65 73 28 29 | 20 63 6f 6e 73 74 0d 0d |eBytes()| const..|
|00005360| 52 65 74 75 72 6e 73 20 | 74 68 65 20 6e 75 6d 62 |Returns |the numb|
|00005370| 65 72 20 6f 66 20 62 79 | 74 65 73 20 66 72 6f 6d |er of by|tes from|
|00005380| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 62 75 66 | the cur|rent buf|
|00005390| 66 65 72 20 70 6f 73 69 | 74 69 6f 6e 20 74 6f 20 |fer posi|tion to |
|000053a0| 74 68 65 20 65 6e 64 20 | 6f 66 20 74 68 65 20 62 |the end |of the b|
|000053b0| 75 66 66 65 72 2e 20 55 | 73 65 20 74 68 65 20 47 |uffer. U|se the G|
|000053c0| 65 74 57 72 69 74 61 62 | 6c 65 42 79 74 65 73 28 |etWritab|leBytes(|
|000053d0| 29 20 61 6e 64 20 57 72 | 69 74 65 28 29 20 6d 65 |) and Wr|ite() me|
|000053e0| 74 68 6f 64 73 20 77 68 | 65 6e 20 79 6f 75 20 77 |thods wh|en you w|
|000053f0| 61 6e 74 20 74 6f 20 63 | 6f 70 79 20 64 61 74 61 |ant to c|opy data|
|00005400| 20 74 6f 20 61 20 73 69 | 6e 6b 2e 0d 0d 76 69 72 | to a si|nk...vir|
|00005410| 74 75 61 6c 20 6c 6f 6e | 67 20 47 65 74 4c 65 6e |tual lon|g GetLen|
|00005420| 67 74 68 28 29 20 63 6f | 6e 73 74 0d 0d 52 65 74 |gth() co|nst..Ret|
|00005430| 75 72 6e 73 20 74 68 65 | 20 74 6f 74 61 6c 20 6c |urns the| total l|
|00005440| 65 6e 67 74 68 20 6f 66 | 20 74 68 65 20 62 75 66 |ength of| the buf|
|00005450| 66 65 72 2e 0d 0d 76 69 | 72 74 75 61 6c 20 6c 6f |fer...vi|rtual lo|
|00005460| 6e 67 20 47 65 74 50 6f | 73 69 74 69 6f 6e 28 29 |ng GetPo|sition()|
|00005470| 20 63 6f 6e 73 74 0d 0d | 52 65 74 75 72 6e 73 20 | const..|Returns |
|00005480| 74 68 65 20 63 75 72 72 | 65 6e 74 20 70 6f 73 69 |the curr|ent posi|
|00005490| 74 69 6f 6e 20 69 6e 20 | 74 68 65 20 62 75 66 66 |tion in |the buff|
|000054a0| 65 72 2e 0d 0d 76 69 72 | 74 75 61 6c 20 76 6f 69 |er...vir|tual voi|
|000054b0| 64 20 52 65 61 64 28 0d | 09 09 09 09 09 76 6f 69 |d Read(.|.....voi|
|000054c0| 64 20 2a 20 64 65 73 74 | 69 6e 61 74 69 6f 6e 2c |d * dest|ination,|
|000054d0| 20 6c 6f 6e 67 20 63 6f | 75 6e 74 29 3b 0d 0d 43 | long co|unt);..C|
|000054e0| 6f 70 69 65 73 20 74 6f | 20 74 68 65 20 64 65 73 |opies to| the des|
|000054f0| 74 69 6e 61 74 69 6f 6e | 20 62 75 66 66 65 72 20 |tination| buffer |
|00005500| 63 6f 75 6e 74 20 62 79 | 74 65 73 20 66 72 6f 6d |count by|tes from|
|00005510| 20 74 68 65 20 62 75 66 | 66 65 72 20 61 73 73 6f | the buf|fer asso|
|00005520| 63 69 61 74 65 64 20 77 | 69 74 68 20 74 68 65 20 |ciated w|ith the |
|00005530| 73 69 6e 6b 2c 20 73 74 | 61 72 74 69 6e 67 20 61 |sink, st|arting a|
|00005540| 74 20 74 68 65 20 73 69 | 6e 6b d5 73 20 63 75 72 |t the si|nk.s cur|
|00005550| 72 65 6e 74 20 70 6f 73 | 69 74 69 6f 6e 2e 20 41 |rent pos|ition. A|
|00005560| 6e 20 61 73 73 65 72 74 | 20 69 73 20 74 72 69 67 |n assert| is trig|
|00005570| 67 65 72 65 64 20 69 66 | 20 74 68 65 20 63 6f 75 |gered if| the cou|
|00005580| 6e 74 20 63 61 6e 6e 6f | 74 20 62 65 20 73 61 74 |nt canno|t be sat|
|00005590| 69 73 66 69 65 64 2e 0d | 0d 76 69 72 74 75 61 6c |isfied..|.virtual|
|000055a0| 20 63 6f 6e 73 74 20 76 | 6f 69 64 2a 20 52 65 61 | const v|oid* Rea|
|000055b0| 64 50 65 65 6b 28 0d 09 | 09 09 09 09 09 09 6c 6f |dPeek(..|......lo|
|000055c0| 6e 67 26 20 61 76 61 69 | 6c 61 62 6c 65 52 65 61 |ng& avai|lableRea|
|000055d0| 64 42 79 74 65 73 29 3b | 0d 0d 52 65 74 75 72 6e |dBytes);|..Return|
|000055e0| 73 20 61 20 70 6f 69 6e | 74 65 72 20 74 6f 20 61 |s a poin|ter to a|
|000055f0| 20 72 65 61 64 2d 6f 6e | 6c 79 20 62 75 66 66 65 | read-on|ly buffe|
|00005600| 72 20 61 76 61 69 6c 61 | 62 6c 65 52 65 61 64 42 |r availa|bleReadB|
|00005610| 79 74 65 73 20 6c 6f 6e | 67 2c 20 61 6e 64 20 72 |ytes lon|g, and r|
|00005620| 65 70 6f 72 74 73 20 68 | 6f 77 20 6d 75 63 68 20 |eports h|ow much |
|00005630| 72 65 61 64 20 64 61 74 | 61 20 69 73 20 61 76 61 |read dat|a is ava|
|00005640| 69 6c 61 62 6c 65 20 69 | 6e 20 74 68 65 20 62 75 |ilable i|n the bu|
|00005650| 66 66 65 72 2e 20 54 68 | 65 20 70 6f 73 69 74 69 |ffer. Th|e positi|
|00005660| 6f 6e 20 69 6e 20 74 68 | 65 20 73 69 6e 6b 20 69 |on in th|e sink i|
|00005670| 73 20 6e 6f 74 20 63 68 | 61 6e 67 65 64 20 62 79 |s not ch|anged by|
|00005680| 20 74 68 65 20 52 65 61 | 64 50 65 65 6b 28 29 20 | the Rea|dPeek() |
|00005690| 63 61 6c 6c 2e 20 0d 44 | 75 72 69 6e 67 20 70 72 |call. .D|uring pr|
|000056a0| 6f 63 65 73 73 69 6e 67 | 2c 20 63 61 6c 6c 20 52 |ocessing|, call R|
|000056b0| 65 61 64 50 65 65 6b 41 | 64 76 61 6e 63 65 28 29 |eadPeekA|dvance()|
|000056c0| 20 74 6f 20 61 64 76 61 | 6e 63 65 20 74 68 65 20 | to adva|nce the |
|000056d0| 70 6f 73 69 74 69 6f 6e | 20 69 6e 20 74 68 65 20 |position| in the |
|000056e0| 73 69 6e 6b 20 70 6f 73 | 69 74 69 6f 6e 20 6d 61 |sink pos|ition ma|
|000056f0| 72 6b 65 72 2e 20 61 76 | 61 69 6c 61 62 6c 65 52 |rker. av|ailableR|
|00005700| 65 61 64 42 79 74 65 73 | 20 69 73 20 73 65 74 20 |eadBytes| is set |
|00005710| 74 6f 20 7a 65 72 6f 20 | 69 66 20 61 6c 6c 20 64 |to zero |if all d|
|00005720| 61 74 61 20 68 61 73 20 | 62 65 65 6e 20 72 65 61 |ata has |been rea|
|00005730| 64 2e 0d 55 73 65 20 52 | 65 61 64 50 65 65 6b 28 |d..Use R|eadPeek(|
|00005740| 29 20 77 69 74 68 20 52 | 65 61 64 50 65 65 6b 41 |) with R|eadPeekA|
|00005750| 64 76 61 6e 63 65 28 29 | 20 77 68 65 6e 20 79 6f |dvance()| when yo|
|00005760| 75 20 77 61 6e 74 20 74 | 6f 20 72 65 61 64 20 64 |u want t|o read d|
|00005770| 61 74 61 20 77 69 74 68 | 6f 75 74 20 6d 61 6b 69 |ata with|out maki|
|00005780| 6e 67 20 61 20 63 6f 70 | 79 20 6f 66 20 69 74 2e |ng a cop|y of it.|
|00005790| 0d 61 76 61 69 6c 61 62 | 6c 65 52 65 61 64 42 79 |.availab|leReadBy|
|000057a0| 74 65 73 20 2d 20 52 65 | 66 65 72 65 6e 63 65 20 |tes - Re|ference |
|000057b0| 74 6f 20 61 20 63 61 6c | 6c 65 72 2d 70 72 6f 76 |to a cal|ler-prov|
|000057c0| 69 64 65 64 20 6c 6f 6e | 67 2e 20 4f 6e 20 72 65 |ided lon|g. On re|
|000057d0| 74 75 72 6e 2c 20 74 68 | 69 73 20 76 61 72 69 61 |turn, th|is varia|
|000057e0| 62 6c 65 20 68 61 73 20 | 62 65 65 6e 20 73 65 74 |ble has |been set|
|000057f0| 20 74 6f 20 74 68 65 20 | 6e 75 6d 62 65 72 20 6f | to the |number o|
|00005800| 66 20 61 76 61 69 6c 61 | 62 6c 65 20 62 79 74 65 |f availa|ble byte|
|00005810| 73 20 69 6e 20 74 68 65 | 20 72 65 74 75 72 6e 65 |s in the| returne|
|00005820| 64 20 62 75 66 66 65 72 | 2e 0d 0d 0d 76 69 72 74 |d buffer|....virt|
|00005830| 75 61 6c 20 76 6f 69 64 | 20 52 65 61 64 50 65 65 |ual void| ReadPee|
|00005840| 6b 41 64 76 61 6e 63 65 | 28 6c 6f 6e 67 20 62 79 |kAdvance|(long by|
|00005850| 74 65 73 52 65 61 64 29 | 0d 0d 41 64 76 61 6e 63 |tesRead)|..Advanc|
|00005860| 65 73 20 74 68 65 20 70 | 6f 73 69 74 69 6f 6e 20 |es the p|osition |
|00005870| 69 6e 20 74 68 65 20 73 | 69 6e 6b 20 62 79 20 74 |in the s|ink by t|
|00005880| 68 65 20 73 70 65 63 69 | 66 69 65 64 20 6e 75 6d |he speci|fied num|
|00005890| 62 65 72 20 6f 66 20 62 | 79 74 65 73 2e 0d 55 73 |ber of b|ytes..Us|
|000058a0| 65 20 52 65 61 64 50 65 | 65 6b 28 29 20 77 69 74 |e ReadPe|ek() wit|
|000058b0| 68 20 52 65 61 64 50 65 | 65 6b 41 64 76 61 6e 63 |h ReadPe|ekAdvanc|
|000058c0| 65 28 29 20 74 6f 20 72 | 65 61 64 20 64 61 74 61 |e() to r|ead data|
|000058d0| 20 77 69 74 68 6f 75 74 | 20 6d 61 6b 69 6e 67 20 | without| making |
|000058e0| 61 20 63 6f 70 79 20 6f | 66 20 69 74 2e 0d 54 68 |a copy o|f it..Th|
|000058f0| 69 73 20 6d 65 74 68 6f | 64 20 74 72 69 67 67 65 |is metho|d trigge|
|00005900| 72 73 20 61 6e 20 61 73 | 73 65 72 74 20 69 66 20 |rs an as|sert if |
|00005910| 62 79 74 65 73 52 65 61 | 64 20 69 73 20 6e 65 67 |bytesRea|d is neg|
|00005920| 61 74 69 76 65 20 6f 72 | 20 69 73 20 67 72 65 61 |ative or| is grea|
|00005930| 74 65 72 20 74 68 61 6e | 20 74 68 65 20 61 76 61 |ter than| the ava|
|00005940| 69 6c 61 62 6c 65 20 62 | 79 74 65 73 20 69 6e 20 |ilable b|ytes in |
|00005950| 74 68 65 20 62 75 66 66 | 65 72 2e 0d 0d 76 69 72 |the buff|er...vir|
|00005960| 74 75 61 6c 20 76 6f 69 | 64 20 53 65 74 50 6f 73 |tual voi|d SetPos|
|00005970| 69 74 69 6f 6e 28 6c 6f | 6e 67 20 70 6f 73 69 74 |ition(lo|ng posit|
|00005980| 69 6f 6e 29 3b 0d 0d 53 | 65 74 73 20 74 68 65 20 |ion);..S|ets the |
|00005990| 70 6f 73 69 74 69 6f 6e | 20 6f 66 20 74 68 65 20 |position| of the |
|000059a0| 62 75 66 66 65 72 20 70 | 6f 73 69 74 69 6f 6e 20 |buffer p|osition |
|000059b0| 70 6f 69 6e 74 65 72 20 | 74 6f 20 70 6f 73 69 74 |pointer |to posit|
|000059c0| 69 6f 6e 2e 0d 0d 76 69 | 72 74 75 61 6c 20 76 6f |ion...vi|rtual vo|
|000059d0| 69 64 20 57 72 69 74 65 | 28 63 6f 6e 73 74 20 76 |id Write|(const v|
|000059e0| 6f 69 64 2a 20 73 6f 75 | 72 63 65 2c 0d 09 09 09 |oid* sou|rce,....|
|000059f0| 09 09 09 6c 6f 6e 67 20 | 63 6f 75 6e 74 29 3b 0d |...long |count);.|
|00005a00| 0d 57 72 69 74 65 73 20 | 6e 75 6d 62 65 72 49 74 |.Writes |numberIt|
|00005a10| 65 6d 73 2a 69 74 65 6d | 53 69 7a 65 20 62 79 74 |ems*item|Size byt|
|00005a20| 65 73 20 66 72 6f 6d 20 | 62 75 66 66 65 72 20 69 |es from |buffer i|
|00005a30| 6e 74 6f 20 73 69 6e 6b | 2e 20 0d 57 72 69 74 65 |nto sink|. .Write|
|00005a40| 73 20 74 6f 20 74 68 65 | 20 69 6e 2d 6d 65 6d 6f |s to the| in-memo|
|00005a50| 72 79 20 62 75 66 66 65 | 72 20 61 20 73 70 65 63 |ry buffe|r a spec|
|00005a60| 69 66 69 65 64 20 6e 75 | 6d 62 65 72 20 6f 66 20 |ified nu|mber of |
|00005a70| 62 79 74 65 73 20 66 72 | 6f 6d 20 61 20 73 70 65 |bytes fr|om a spe|
|00005a80| 63 69 66 69 65 64 20 62 | 75 66 66 65 72 2e 20 55 |cified b|uffer. U|
|00005a90| 73 65 20 74 68 65 20 47 | 65 74 57 72 69 74 61 62 |se the G|etWritab|
|00005aa0| 6c 65 42 79 74 65 73 28 | 29 20 61 6e 64 20 57 72 |leBytes(|) and Wr|
|00005ab0| 69 74 65 28 29 20 6d 65 | 74 68 6f 64 73 20 74 6f |ite() me|thods to|
|00005ac0| 20 63 6f 70 79 20 64 61 | 74 61 20 66 72 6f 6d 20 | copy da|ta from |
|00005ad0| 61 20 73 69 6e 6b 2e 0d | 0d 76 6f 69 64 2a 20 57 |a sink..|.void* W|
|00005ae0| 72 69 74 65 50 65 65 6b | 28 6c 6f 6e 67 26 20 61 |ritePeek|(long& a|
|00005af0| 76 61 69 6c 61 62 6c 65 | 57 72 69 74 65 42 79 74 |vailable|WriteByt|
|00005b00| 65 73 29 0d 0d 52 65 74 | 75 72 6e 73 20 61 20 70 |es)..Ret|urns a p|
|00005b10| 6f 69 6e 74 65 72 20 74 | 6f 20 61 20 77 72 69 74 |ointer t|o a writ|
|00005b20| 65 2d 6f 6e 6c 79 20 62 | 75 66 66 65 72 20 61 6e |e-only b|uffer an|
|00005b30| 64 20 72 65 70 6f 72 74 | 73 20 68 6f 77 20 6d 61 |d report|s how ma|
|00005b40| 6e 79 20 62 79 74 65 73 | 20 61 72 65 20 61 76 61 |ny bytes| are ava|
|00005b50| 69 6c 61 62 6c 65 20 69 | 6e 20 74 68 65 20 62 75 |ilable i|n the bu|
|00005b60| 66 66 65 72 2e 20 54 68 | 65 20 57 72 69 74 65 50 |ffer. Th|e WriteP|
|00005b70| 65 65 6b 20 6d 65 74 68 | 6f 64 20 64 6f 65 73 20 |eek meth|od does |
|00005b80| 6e 6f 74 20 63 68 61 6e | 67 65 20 73 69 6e 6b 20 |not chan|ge sink |
|00005b90| 63 75 72 72 65 6e 74 20 | 70 6f 73 69 74 69 6f 6e |current |position|
|00005ba0| 20 6d 61 72 6b 65 72 2e | 20 43 61 6c 6c 20 57 72 | marker.| Call Wr|
|00005bb0| 69 74 65 50 65 65 6b 2d | 41 64 76 61 6e 63 65 20 |itePeek-|Advance |
|00005bc0| 74 6f 20 61 64 76 61 6e | 63 65 20 74 68 65 20 73 |to advan|ce the s|
|00005bd0| 69 6e 6b 20 63 75 72 72 | 65 6e 74 20 70 6f 73 69 |ink curr|ent posi|
|00005be0| 74 69 6f 6e 20 6d 61 72 | 6b 65 72 2e 0d 55 73 65 |tion mar|ker..Use|
|00005bf0| 20 57 72 69 74 65 50 65 | 65 6b 20 77 69 74 68 20 | WritePe|ek with |
|00005c00| 57 72 69 74 65 50 65 65 | 6b 41 64 76 61 6e 63 65 |WritePee|kAdvance|
|00005c10| 20 74 6f 20 77 72 69 74 | 65 20 64 61 74 61 20 77 | to writ|e data w|
|00005c20| 69 74 68 6f 75 74 20 6d | 61 6b 69 6e 67 20 61 20 |ithout m|aking a |
|00005c30| 63 6f 70 79 20 6f 66 20 | 69 74 2e 20 46 6f 72 20 |copy of |it. For |
|00005c40| 65 78 61 6d 70 6c 65 3b | 20 74 6f 20 77 72 69 74 |example;| to writ|
|00005c50| 65 20 61 20 73 65 71 75 | 65 6e 63 65 20 6f 66 20 |e a sequ|ence of |
|00005c60| 69 6e 74 65 67 65 72 73 | 20 6f 75 74 20 61 73 20 |integers| out as |
|00005c70| 41 53 43 49 49 20 73 74 | 72 69 6e 67 73 2c 20 63 |ASCII st|rings, c|
|00005c80| 72 65 61 74 65 20 79 6f | 75 72 20 6f 77 6e 20 62 |reate yo|ur own b|
|00005c90| 75 66 66 65 72 2c 20 74 | 72 61 6e 73 66 6f 72 6d |uffer, t|ransform|
|00005ca0| 20 74 68 65 20 69 6e 74 | 65 67 65 72 73 20 69 6e | the int|egers in|
|00005cb0| 74 6f 20 41 53 43 49 49 | 20 73 74 72 69 6e 67 73 |to ASCII| strings|
|00005cc0| 20 69 6e 20 74 68 65 20 | 62 75 66 66 65 72 2c 20 | in the |buffer, |
|00005cd0| 61 6e 64 20 74 68 65 6e | 20 77 72 69 74 65 20 6f |and then| write o|
|00005ce0| 75 74 20 74 68 65 20 62 | 75 66 66 65 72 2e 20 59 |ut the b|uffer. Y|
|00005cf0| 6f 75 20 73 61 76 65 20 | 6f 6e 65 20 63 6f 70 79 |ou save |one copy|
|00005d00| 20 6f 70 65 72 61 74 69 | 6f 6e 20 69 66 20 79 6f | operati|on if yo|
|00005d10| 75 20 75 73 65 20 57 72 | 69 74 65 50 65 65 6b 20 |u use Wr|itePeek |
|00005d20| 61 6e 64 20 57 72 69 74 | 65 50 65 65 6b 2d 41 64 |and Writ|ePeek-Ad|
|00005d30| 76 61 6e 63 65 2e 0d 61 | 76 61 69 6c 61 62 6c 65 |vance..a|vailable|
|00005d40| 57 72 69 74 65 42 79 74 | 65 73 20 2d 20 52 65 66 |WriteByt|es - Ref|
|00005d50| 65 72 65 6e 63 65 20 74 | 6f 20 61 20 63 61 6c 6c |erence t|o a call|
|00005d60| 65 72 2d 70 72 6f 76 69 | 64 65 64 20 6c 6f 6e 67 |er-provi|ded long|
|00005d70| 2e 20 4f 6e 20 72 65 74 | 75 72 6e 2c 20 74 68 69 |. On ret|urn, thi|
|00005d80| 73 20 76 61 72 69 61 62 | 6c 65 20 68 61 73 20 62 |s variab|le has b|
|00005d90| 65 65 6e 20 73 65 74 20 | 74 6f 20 74 68 65 20 6e |een set |to the n|
|00005da0| 75 6d 62 65 72 20 6f 66 | 20 61 76 61 69 6c 61 62 |umber of| availab|
|00005db0| 6c 65 20 62 79 74 65 73 | 20 69 6e 20 74 68 65 20 |le bytes| in the |
|00005dc0| 62 75 66 66 65 72 20 70 | 6f 69 6e 74 65 64 20 74 |buffer p|ointed t|
|00005dd0| 6f 20 62 79 20 74 68 65 | 20 72 65 74 75 72 6e 20 |o by the| return |
|00005de0| 76 61 6c 75 65 2e 0d 0d | 76 6f 69 64 20 57 72 69 |value...|void Wri|
|00005df0| 74 65 50 65 65 6b 41 64 | 76 61 6e 63 65 28 6c 6f |tePeekAd|vance(lo|
|00005e00| 6e 67 20 62 79 74 65 73 | 57 72 69 74 74 65 6e 29 |ng bytes|Written)|
|00005e10| 0d 0d 41 64 76 61 6e 63 | 65 73 20 74 68 65 20 70 |..Advanc|es the p|
|00005e20| 6f 73 69 74 69 6f 6e 20 | 69 6e 20 74 68 65 20 73 |osition |in the s|
|00005e30| 69 6e 6b 20 62 79 20 62 | 79 74 65 73 57 72 69 74 |ink by b|ytesWrit|
|00005e40| 74 65 6e 20 62 79 74 65 | 73 2e 0d 55 73 65 20 57 |ten byte|s..Use W|
|00005e50| 72 69 74 65 50 65 65 6b | 20 77 69 74 68 20 57 72 |ritePeek| with Wr|
|00005e60| 69 74 65 50 65 65 6b 41 | 64 76 61 6e 63 65 20 74 |itePeekA|dvance t|
|00005e70| 6f 20 77 72 69 74 65 20 | 64 61 74 61 20 77 69 74 |o write |data wit|
|00005e80| 68 6f 75 74 20 6d 61 6b | 69 6e 67 20 61 20 63 6f |hout mak|ing a co|
|00005e90| 70 79 20 6f 66 20 69 74 | 2e 20 0d 46 6f 72 20 65 |py of it|. .For e|
|00005ea0| 78 61 6d 70 6c 65 3b 20 | 74 6f 20 77 72 69 74 65 |xample; |to write|
|00005eb0| 20 61 20 73 65 71 75 65 | 6e 63 65 20 6f 66 20 69 | a seque|nce of i|
|00005ec0| 6e 74 65 67 65 72 73 20 | 6f 75 74 20 61 73 20 41 |ntegers |out as A|
|00005ed0| 53 43 49 49 20 73 74 72 | 69 6e 67 73 3b 20 63 72 |SCII str|ings; cr|
|00005ee0| 65 61 74 65 20 79 6f 75 | 72 20 6f 77 6e 20 62 75 |eate you|r own bu|
|00005ef0| 66 66 65 72 2c 20 74 72 | 61 6e 73 66 6f 72 6d 20 |ffer, tr|ansform |
|00005f00| 74 68 65 20 69 6e 74 65 | 67 65 72 73 20 69 6e 74 |the inte|gers int|
|00005f10| 6f 20 41 53 43 49 49 20 | 73 74 72 69 6e 67 73 20 |o ASCII |strings |
|00005f20| 69 6e 20 74 68 65 20 62 | 75 66 66 65 72 2c 20 61 |in the b|uffer, a|
|00005f30| 6e 64 20 74 68 65 6e 20 | 77 72 69 74 65 20 6f 75 |nd then |write ou|
|00005f40| 74 20 74 68 65 20 62 75 | 66 66 65 72 2e 20 59 6f |t the bu|ffer. Yo|
|00005f50| 75 20 73 61 76 65 20 6f | 6e 65 20 63 6f 70 79 20 |u save o|ne copy |
|00005f60| 6f 70 65 72 61 74 69 6f | 6e 20 69 66 20 79 6f 75 |operatio|n if you|
|00005f70| 20 75 73 65 20 57 72 69 | 74 65 50 65 65 6b 20 61 | use Wri|tePeek a|
|00005f80| 6e 64 20 57 72 69 74 65 | 50 65 65 6b 41 64 76 61 |nd Write|PeekAdva|
|00005f90| 6e 63 65 2e 0d 62 79 74 | 65 73 57 72 69 74 74 65 |nce..byt|esWritte|
|00005fa0| 6e 20 2d 20 6e 75 6d 62 | 65 72 20 6f 66 20 62 79 |n - numb|er of by|
|00005fb0| 74 65 73 20 74 6f 20 61 | 64 76 61 6e 63 65 20 74 |tes to a|dvance t|
|00005fc0| 68 65 20 63 75 72 72 65 | 6e 74 20 73 69 6e 6b 20 |he curre|nt sink |
|00005fd0| 6d 61 72 6b 65 72 2e 20 | 0d 46 57 5f 43 52 61 6e |marker. |.FW_CRan|
|00005fe0| 64 6f 6d 41 63 63 65 73 | 73 53 69 6e 6b 20 43 6c |domAcces|sSink Cl|
|00005ff0| 61 73 73 0d 49 6e 74 72 | 6f 64 75 63 74 69 6f 6e |ass.Intr|oduction|
|00006000| 0d 46 57 5f 43 52 61 6e | 64 6f 6d 41 63 63 65 73 |.FW_CRan|domAcces|
|00006010| 73 53 69 6e 6b 20 69 73 | 20 61 6e 20 61 62 73 74 |sSink is| an abst|
|00006020| 72 61 63 74 20 62 61 73 | 65 20 63 6c 61 73 73 20 |ract bas|e class |
|00006030| 77 68 69 63 68 20 64 65 | 66 69 6e 65 73 20 61 6e |which de|fines an|
|00006040| 20 69 6e 74 65 72 66 61 | 63 65 20 63 6f 6d 6d 6f | interfa|ce commo|
|00006050| 6e 20 74 6f 20 61 6c 6c | 20 73 69 6e 6b 73 20 74 |n to all| sinks t|
|00006060| 68 61 74 20 72 65 70 72 | 65 73 65 6e 74 20 72 61 |hat repr|esent ra|
|00006070| 6e 64 6f 6d 20 61 63 63 | 65 73 73 20 64 65 76 69 |ndom acc|ess devi|
|00006080| 63 65 73 2e 20 0d 46 57 | 5f 43 52 61 6e 64 6f 6d |ces. .FW|_CRandom|
|00006090| 41 63 63 65 73 73 53 69 | 6e 6b 20 70 72 6f 76 69 |AccessSi|nk provi|
|000060a0| 64 65 73 20 61 20 70 72 | 6f 74 6f 63 6f 6c 20 66 |des a pr|otocol f|
|000060b0| 6f 72 20 64 65 73 69 67 | 6e 69 6e 67 20 61 20 64 |or desig|ning a d|
|000060c0| 61 74 61 20 73 74 72 65 | 61 6d 20 77 68 69 63 68 |ata stre|am which|
|000060d0| 20 63 61 6e 20 62 65 20 | 73 65 61 72 63 68 65 64 | can be |searched|
|000060e0| 20 61 74 20 72 61 6e 64 | 6f 6d 2e 20 53 69 6e 6b | at rand|om. Sink|
|000060f0| 73 20 74 79 70 69 63 61 | 6c 6c 79 20 61 72 65 20 |s typica|lly are |
|00006100| 61 74 74 61 63 68 65 64 | 20 74 6f 20 73 74 72 65 |attached| to stre|
|00006110| 61 6d 73 2c 20 62 75 74 | 20 74 68 65 79 20 63 61 |ams, but| they ca|
|00006120| 6e 20 62 65 20 75 73 65 | 64 20 62 79 20 74 68 65 |n be use|d by the|
|00006130| 6d 73 65 6c 76 65 73 2e | 20 0d 46 6f 72 20 63 6f |mselves.| .For co|
|00006140| 6e 76 65 6e 69 65 6e 63 | 65 2c 20 4f 50 46 20 69 |nvenienc|e, OPF i|
|00006150| 6e 63 6c 75 64 65 73 20 | 74 68 65 73 65 20 63 6f |ncludes |these co|
|00006160| 6e 63 72 65 74 65 20 64 | 65 72 69 76 61 74 69 6f |ncrete d|erivatio|
|00006170| 6e 73 20 6f 66 20 74 68 | 69 73 20 63 6c 61 73 73 |ns of th|is class|
|00006180| 3a 0d a5 09 09 46 57 5f | 43 46 69 6c 65 41 63 63 |:....FW_|CFileAcc|
|00006190| 65 73 73 20 6f 62 6a 65 | 63 74 73 20 68 61 6e 64 |ess obje|cts hand|
|000061a0| 6c 65 20 49 4f 20 77 69 | 74 68 20 61 20 64 69 73 |le IO wi|th a dis|
|000061b0| 6b 2d 62 61 73 65 64 20 | 66 69 6c 65 2e 0d a5 09 |k-based |file....|
|000061c0| 46 57 5f 43 4d 65 6d 6f | 72 79 53 69 6e 6b 20 6f |FW_CMemo|rySink o|
|000061d0| 62 6a 65 63 74 73 20 68 | 61 6e 64 6c 65 20 49 4f |bjects h|andle IO|
|000061e0| 20 77 69 74 68 20 61 20 | 6d 65 6d 6f 72 79 20 62 | with a |memory b|
|000061f0| 75 66 66 65 72 2e 0d a5 | 09 46 57 5f 43 52 65 73 |uffer...|.FW_CRes|
|00006200| 6f 75 72 63 65 53 69 6e | 6b 20 6f 62 6a 65 63 74 |ourceSin|k object|
|00006210| 73 20 68 61 6e 64 6c 65 | 20 49 4f 20 77 69 74 68 |s handle| IO with|
|00006220| 20 61 20 72 65 73 6f 75 | 72 63 65 20 66 69 6c 65 | a resou|rce file|
|00006230| 2e 0d 48 65 61 64 65 72 | 20 46 69 6c 65 0d 46 57 |..Header| File.FW|
|00006240| 41 53 69 6e 6b 73 2e 68 | 0d 48 65 72 69 74 61 67 |ASinks.h|.Heritag|
|00006250| 65 0d 46 57 5f 43 53 69 | 6e 6b 09 33 39 0d a5 46 |e.FW_CSi|nk.39..F|
|00006260| 57 5f 43 52 61 6e 64 6f | 6d 41 63 63 65 73 73 53 |W_CRando|mAccessS|
|00006270| 69 6e 6b 0d a5 a5 46 57 | 5f 43 46 69 6c 65 41 63 |ink...FW|_CFileAc|
|00006280| 63 65 73 73 09 78 78 0d | a5 a5 46 57 5f 43 4d 65 |cess.xx.|..FW_CMe|
|00006290| 6d 6f 72 79 53 69 6e 6b | 09 31 35 0d a5 a5 a5 46 |morySink|.15....F|
|000062a0| 57 5f 43 52 65 73 6f 75 | 72 63 65 53 69 6e 6b 09 |W_CResou|rceSink.|
|000062b0| 78 78 0d 55 73 69 6e 67 | 20 46 57 5f 43 52 61 6e |xx.Using| FW_CRan|
|000062c0| 64 6f 6d 41 63 63 65 73 | 73 53 69 6e 6b 0d 46 57 |domAcces|sSink.FW|
|000062d0| 5f 43 52 61 6e 64 6f 6d | 41 63 63 65 73 73 53 69 |_CRandom|AccessSi|
|000062e0| 6e 6b 20 64 65 66 69 6e | 65 73 20 74 68 65 20 70 |nk defin|es the p|
|000062f0| 72 6f 74 6f 63 6f 6c 20 | 66 6f 72 20 69 6e 74 65 |rotocol |for inte|
|00006300| 72 61 63 74 69 6e 67 20 | 77 69 74 68 20 66 69 6c |racting |with fil|
|00006310| 65 73 2e 20 41 20 66 69 | 6c 65 20 64 6f 65 73 20 |es. A fi|le does |
|00006320| 6e 6f 74 20 61 6c 77 61 | 79 73 20 72 65 66 65 72 |not alwa|ys refer|
|00006330| 20 74 6f 20 61 20 64 69 | 73 6b 2d 62 61 73 65 64 | to a di|sk-based|
|00006340| 20 72 65 70 72 65 73 65 | 6e 74 61 74 69 6f 6e 2c | represe|ntation,|
|00006350| 20 62 75 74 20 72 65 70 | 72 65 73 65 6e 74 73 20 | but rep|resents |
|00006360| 61 6e 79 20 69 6e 74 65 | 72 66 61 63 65 20 74 68 |any inte|rface th|
|00006370| 61 74 20 63 61 6e 20 72 | 65 61 64 20 61 6e 64 20 |at can r|ead and |
|00006380| 77 72 69 74 65 20 72 61 | 6e 64 6f 6d 6c 79 20 66 |write ra|ndomly f|
|00006390| 72 6f 6d 20 73 6f 6d 65 | 20 65 6e 74 69 74 79 2e |rom some| entity.|
|000063a0| 20 0d 54 68 69 73 20 63 | 6c 61 73 73 20 72 65 61 | .This c|lass rea|
|000063b0| 64 73 20 61 6e 64 20 77 | 72 69 74 65 73 20 64 61 |ds and w|rites da|
|000063c0| 74 61 20 66 72 6f 6d 20 | 61 20 73 74 61 74 69 63 |ta from |a static|
|000063d0| 20 73 6f 75 72 63 65 2e | 20 54 68 65 20 64 6f 63 | source.| The doc|
|000063e0| 75 6d 65 6e 74 20 6d 6f | 64 65 6c 20 61 6c 73 6f |ument mo|del also|
|000063f0| 20 70 72 6f 76 69 64 65 | 73 20 61 20 73 75 62 63 | provide|s a subc|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.